# Cheating Time solution codechef

## Cheating Time solution codechef

Chef’s college is conducting an online exam, where his camera will be monitored by one or more invigilators (supervisors). Once again, Chef failed to prepare for the exam on time and decided to google answers during it.

The exam starts at time 00 and ends at time FF minutes. Chef needs a total of KK minutes of googling during the exam in order to pass it. There are NN invigilators (numbered 11 through NN); for each valid ii, the ii-th invigilator monitors Chef’s camera during the time interval starting at SiSi minutes since the start of the exam and ending at EiEi minutes (where 0SiEiF0≤Si≤Ei≤F).

He was resourceful enough to somehow get hold of these times and now he wants to know if he would be able to pass the exam if he googles the answers during the times when no one is looking at his camera.

### Input Cheating Time solution codechef

• The first line of the input contains a single integer TT denoting the number of test cases. The description of TT test cases follows.
• The first line of each test case contains three space-separated integers NNKK and FF.
• NN lines follow. For each valid ii, the ii-th of these lines contains two space-separated integers SiSi and EiEi.

### Output Cheating Time solution codechef

For each test case, print a single line containing the string "YES" if it is possible to pass the exam or "NO" if it is impossible.

You may print each character of each string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

### Constraints Cheating Time solution codechef

• 1T1051≤T≤105
• 1N1051≤N≤105
• 1F1091≤F≤109
• 0KF0≤K≤F
• 0SiEiF0≤Si≤Ei≤F for each valid ii
• the sum of NN over all test cases does not exceed 21052⋅105

### Example Input Cheating Time solution codechef

3
1 10 10
0 10
2 2 10
0 5
7 10
2 2 100
0 5
5 10


### Example Output Cheating Time solution codechef

NO
YES
YES


### Explanation Cheating Time solution codechef

Example case 1: There is no point during the exam when Chef is not monitored, so he is unable to google even for a single second and will fail the exam.

Example case 2: Chef can google for 22 minutes (in the time interval [5,7][5,7], when he is not monitored) and hence will be able to pass the exam.

Example case 3: Chef can google for 22 minutes (in the time interval [10,12][10,12]) and hence will be able to pass the exam.

# SOLUTION

#### What’s in it for you?

The idea behind these programming contests is that we want you to learn while competing. Also we believe that it is alright to refer to tutorials, books and other materials, learn a concept and then apply the same to solve a problem during a contest. But it is not alright to copy other people’s solutions or seek other people’s help to solve a problem without understanding it.

The dividing line may seem to be thin but it can be captured by the spirit of learning. If whatever you are doing is making you learn while you do so, we tend to believe that it is alright. Our sole intention lies in making our users learn new concepts while competing. However, all the participants are expected to abide to

#### What’s new in CodeChef?

You may now play with our new groups & LaTex feature on discuss.

• Please do not discuss strategy, suggestions or tips in the comments during a live contest. Posting questions clarifying the problem statement is ok. If you are unsure, email us at [email protected] .
• Discussing CodeChef’s problems or any aspect of problem, on any other platform on web, on identification, could lead to disabling of respective account and banning from the community.
• You can also send in your queries in an email to [email protected], during the contest.
• You will receive one point for solving a problem (passing all test cases – no partial credit), regardless of the level of difficulty of that problem.
• Users are ranked according to the most problems solved. Ties will be broken by the total time for each user in ascending order of time.
• The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the first accepted run plus 10 penalty minutes for every previously rejected run for that problem. There is no time consumed for a problem that is not solved.
• You shall not possess more than one account on CodeChef. If you have, then do let us know, so that we can deactivate the insignificant one. If you do not report it and we come to know about it, we may deactivate both the accounts permanently.
• If anyone is using code from some other source in his submission, he should provide proper attribution. Failing this, it may be considered plagiarism and the submission will be subject to disqualification.
• The number of submissions that one can make during the contest on a single problem will be limited to 500.
• Residents of the following countries and territories are not eligible to win cash prizes/laddus/goodies due to legal restrictions: Albania, The Bahamas, Barbados, Botswana, Cambodia, Crimea region of Russia, Cuba, Ghana, Iceland, Iran, Jamaica, Mauritius, Mongolia, Myanmar, Nicaragua, North Korea, Pakistan, Panama, Sudan, Syria, Uganda, Yemen, Zimbabwe.

Note: You can now “Code, Compile, and Run” your codes on our Online IDE.

However, if you are using any other online development environment, make sure that other contestants don’t have access to your code. As a contestant, you are responsible for making sure others don’t access the code that you submit. If you use Ideone, make sure to mark your submission “private” (not secret)”.