Submit | All submissions | Best solutions | Back to list |
FUPRCO - Funny programming contest |
Bob is trying to solve many problems.
Today he's trying to do his best at "Funny programming contest". In this contest there is N rounds.
Each round is starting in moment Ai and ends in moment Bi. Rounds can overlap on each other. For each round there is one problem to solve. He can't solve more than one problem at once.
Bob knows that problems are very difficult, so he assumed that he will do each round for more than half of time the round lasts.
He knows start and end time for each round.
Help him figuring out if he can spend as much time as he want for each round.
Input
First line contains number N (1 <= N <= 2*10^5). In the next N lines there are three numbers, ai, bi, ci (0 <= ai < bi <= 10^9, (bi-ai)/2 < ci <= bi-ai), time when round i starts, time when round i ends, and time which Bob wants to spend for round i.
Output
Print "YES" if Bob can spend as much time as he wants for each round, otherwise print "NO"
Example
Input: 2 1 5 3 1 2 1 Output: YES
Input: 2 1 5 3 2 3 1 Output: NO
Added by: | Krzysztof Lewko |
Date: | 2011-06-04 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | http://oboz.ilo.pl/ http://main.edu.pl/pl/archive/proserwy |
hide comments
2016-10-16 13:45:36 enigmus
Watch for the boundaries of the input data, they hold the key to the solution! |
|
2015-11-02 07:38:31 rahul_verma
give me more test cases |