Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

CloX

By zobayer · Limits 1s, 512 MB

Given two clocks with no digits printed on them and only two hands, one smaller for hour and one bigger for minute, you have to determine whether the two clocks are visually distinguishable. You will have the timestamps for each clock.

Note that, we don’t want to distinguish between angles with a difference less than 0.05, i.e., two angles a and b will be considered equal if and only if |a-b| < 0.05.

Input

The first line will contain an integer T (T <= 3*10^5), the number of test cases. Next T lines will contain 6 integers h1, m1, s1, h2, m2, and s2 as shown in sample input. Here h, m and s are the hour, minute and second of the timestamps. All times will be valid and in a 24-hours time format. All times will be given in such a way that the difference angle between the hands will be approximately around some multiple of 10.

Output

For each test case, print the test case serial and “Yes” if the clock states are distinguishable, else print “No”. Check sample output for details.

Sample

InputOutput
2
0:16:22 0:49:6
1:21:50 2:27:17
Case 1: Yes
Case 2: No

Judge solution uses an EPS value of 1e-9.

    Discussion

    Statistics


    64% Solution Ratio

    Hamim_CuetEarliest, 1w ago

    Hamim_CuetFastest, 0.1s

    Hamim_CuetLightest, 4.2 MB

    BerlekampMassyShortest, 525B

    Submit

    Login to submit