P23598 [AtCoder] Inverted Clock
提高+
题目描述

Problem Description

You overslept for the morning programming contest! But don't panic yet. You have a magical tool called the "Inverted Clock" that allows you to manipulate time.

Although you can manipulate time, you can't freely turn back time. The Inverted Clock is an analog clock with a 12-hour dial that has no numbers on it. By rotating it 180 degrees, you can move to the time indicated by the hands after rotation. Specifically, if you rotate the Inverted Clock at 12 AM $ h $ hours and $ m $ minutes, you will move to 12 AM $ ((h+6)%12) $ hours and $ ((m+30)%60) $ minutes on the same day. For example, if you use the Inverted Clock at 9:30 AM, you can go back to 3:00 AM on the same day. (It seems you don't need to worry about the precise position of the hour hand.)

figure1 However, the power of the Inverted Clock can only be used once a day. Also, once you pass noon, you can't go back to the morning, so you don't have much time to relax. Let's see if you can hurry back to the time when the morning programming contest starts.

Input Format

The start time of the morning programming contest and the current time are given from standard input in the following format:

$ ht $ $ mt $ $ hn $ $ mn $

$ ht $ and $ mt $ ($0 \leq ht \leq 11$, $0 \leq mt \leq 59$) indicate that the start time of the morning programming contest is 12 AM $ ht $ hours and $ mt $ minutes, and $ hn $ and $ mn $ ($0 \leq hn \leq 11$, $0 \leq mn \leq 59$) indicate that the current time is 12 AM $ hn $ hours and $ mn $ minutes.

Output Format

If you can go back to before the start time of the morning programming contest by using the Inverted Clock once after the current time, output Yes. If you can't go back, output No. If you can move exactly to the start time of the morning programming contest, consider it as being able to go back. Output should be on one line, followed by a newline.

Sample Input and Output

Sample Input #1

9 0
10 30

Sample Output #1

Yes

Sample Input #2

3 0
10 30

Sample Output #2

No

Sample Input #3

5 0
11 0

Sample Output #3

Yes

Sample Input #4

9 0
8 30

Sample Output #4

Yes

Notes/Hints

Sample Explanation 1

If you wake up at 10:30 AM and use the Inverted Clock immediately, you can go back to 4:00 AM and make it to the morning programming contest.

Sample Explanation 2

No matter when you use the Inverted Clock, you can't go back to before 4:00 AM.

Sample Explanation 3

If you wait until 11:30 AM and then use the Inverted Clock, you can go back to 5:00 AM.

Sample Explanation 4

It seems you misread the clock.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
9 0 10 30
样例输出
Yes