Alice and Bob have scheduled a meeting inside of the Cathedral of Learning. Unfortunately, they didn't decide what floor to meet on!
The Cathedral of Learning has floors. Alice will start on floor
and Bob will start on floor
. The two will then employ opposing strategies to try and find the other: Every minute Alice and Bob will each explore the floor they are on, and will find each other if they are on the same floor. At the end of the minute Alice will take an elevator one floor up, and simultaneously Bob will take an elevator one floor down. They will repeat this process until either they meet up or one of the two can no longer continue the process (i.e. Alice finishes exploring floor
or Bob finishes exploring floor
) in which case they will leave the building and agree to meet up at a later time.
Given and
determine if Alice and Bob will successfully meet up within the Cathedral of Learning.
Constraints
Subtask 1 [60%]
Subtask 2 [40%]
No additional constraints.
Input Specification
The first line contains the integer .
The second line contains the integer .
The third line contains the integer .
Output Specification
On a single line output the string YES
or the string NO
- corresponding to whether Alice and Bob will meet in the given scenario.
Sample Input 1
5
3
4
Sample Output 1
NO
Explanation for Sample Output 1
In the first minute Alice will explore floor 3 and Bob will explore floor 4 - they will not meet.
Alice will then take the elevator to floor 4 while simultaneously Bob takes the elevator to floor 3.
In the second minute Alice will explore floor 4 and Bob will explore floor 3 - they will not meet.
Alice will then take the elevator to floor 5 while simultaneously Bob takes the elevator to floor 2.
In the third minute Alice will explore floor 5 and Bob will explore floor 2 - they will not meet.
Alice has now explored the top floor and will then leave the cathedral - Alice and Bob will not meet in the cathedral.
Sample Input 2
10
4
4
Sample Output 2
YES
Sample Input 3
12345
1
12345
Sample Output 3
YES
Sample Input 4
12345
12345
1
Sample Output 4
NO
Comments