Submit | All submissions | Best solutions | Back to list |
HEARTS - Heart Smuggler |
Dev is a heart smuggler and has stolen the heart of a girl in his class. Dev's class is situated at position X on a long road. If he reaches his home at position Y on the road(X < Y), he is safe. Unfortunately, the police have found out about Dev's smuggling activity and in an attempt to catch him, they start patrolling the road from position C to D(C < D). If Dev sets foot on any are between C and D he will get caught. Given X, Y, C, D determine if Dev can reach his home without getting caught by the police.
Input
Each test case consists of one line denoting four integers (X Y C D), separated by single spaces.
You can safely assume that (X < Y) and (C < D).
0 <= X, Y, C, D <= 10 ^ 6
Output
Print a line saying "YES", if Dev can reach his home safely, else print "NO".
Example
Input
1 5 4 6
Output
NO
Dev starts at position 1 and has to go to position 5 on the road. Unfortunately, the police are patrolling between positions 4 and 6. Hence Dev will get caught somewhere between position 4 and 5. So the output is "NO".
(Look at the image for better explanation)
Example 2
Input
1 5 7 10
Output
YES
Added by: | kousik |
Date: | 2013-09-13 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Common problem |