codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

868B.md (2491B)


      1 Source: https://codeforces.com/problemset/problem/868/B
      2 
      3 B. Race Against Time
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each other.
     22 
     23 The entire universe turned into an enormous clock face with three hands — hour, minute, and second. Time froze, and clocks now show the time *h* hours, *m* minutes, *s* seconds.
     24 
     25 Last time Misha talked with the coordinator at *t*1 o'clock, so now he stands on the number *t*1 on the clock face. The contest should be ready by *t*2 o'clock. In the terms of paradox it means that Misha has to go to number *t*2 somehow. Note that he doesn't have to move forward only: in these circumstances time has no direction.
     26 
     27 Clock hands are very long, and Misha cannot get round them. He also cannot step over as it leads to the collapse of space-time. That is, if hour clock points 12 and Misha stands at 11 then he cannot move to 1 along the top arc. He has to follow all the way round the clock center (of course, if there are no other hands on his way).
     28 
     29 Given the hands' positions, *t*1, and *t*2, find if Misha can prepare the contest on time (or should we say on space?). That is, find if he can move from *t*1 to *t*2 by the clock face.
     30 
     31 Input
     32 
     33 Five integers *h*, *m*, *s*, *t*1, *t*2 (1 ≤ *h* ≤ 12, 0 ≤ *m*, *s* ≤ 59, 1 ≤ *t*1, *t*2 ≤ 12, *t*1 ≠ *t*2).
     34 
     35 Misha's position and the target time do not coincide with the position of any hand.
     36 
     37 Output
     38 
     39 Print "YES" (quotes for clarity), if Misha can prepare the contest on time, and "NO" otherwise.
     40 
     41 You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 12 30 45 3 11
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 NO
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 12 0 1 12 1
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 YES
     67 ```
     68 
     69 Input
     70 
     71 ```
     72 3 47 0 4 9
     73 ```
     74 
     75 Output
     76 
     77 ```
     78 YES
     79 ```
     80 
     81 Note
     82 
     83 The three examples are shown on the pictures below from left to right. The starting position of Misha is shown with green, the ending position is shown with pink. Note that the positions of the hands on the pictures are not exact, but are close to the exact and the answer is the same.
     84 
     85  ![](https://espresso.codeforces.com/bce115ce252800c8518f002b1f3de40c04fa0f2d.png)