#P9222. 「PEOI Rd1」Morning or Afternoon
「PEOI Rd1」Morning or Afternoon
Problem Description
There is a pointer alarm clock that can show the date using a rotating dial. I observed it from one moment to another moment (a closed interval). Now I want to know whether I can be sure to infer whether it is currently in the morning or in the afternoon by checking whether the date changes during this interval.
The alarm clock updates the date exactly at in the morning.
After in the morning/afternoon, the time becomes in the afternoon/morning. After in the morning/afternoon, the time becomes in the morning/afternoon.
Input Format
The first line contains a positive integer , the number of test cases.
The next lines each contain two times separated by a space, representing the start observation time and the end observation time. Note that the observation time interval is a closed interval.
A time is given in the form , where is the hour and is the minute. If the digit is not omitted, then . It is guaranteed that and .
Output Format
For each test case, output one line: if you can determine it for sure, output Yes; otherwise output No.
7
11:30 12:20
12:20 5:00
11:45 1:04
12:10 12:59
1:09 8:01
12:00 1:00
12:00 12:00
Yes
No
Yes
No
No
No
No
Hint
Sample Explanation #1
Because I observed from to (assume this is the first time it is observed; the a.m./p.m. of later occurrences of can be inferred from the current situation, because I know which occurrence the right endpoint is), I can determine whether the time is in the morning or afternoon by checking whether the date was updated during this period. For example, if I see that the clock updated the date during this period, then must be in the morning; otherwise must be in the afternoon.
Sample #3 is similar.
Sample Explanation #2
It could be from a.m. to a.m., or it could be from p.m. to p.m. In both cases, the date cannot change, so I cannot determine it.
Constraints
For of the points, all times are guaranteed not to have hour (that is, times like 12:25 will not appear).
For another of the points, . \color{#fff}\sout\text{No, Commander-in-Chief!}
For of the testdata, , \overline\texttt{ab}\in[1,12], and \overline\texttt{cd}\in[0,59].
Translated by ChatGPT 5