CF868B.Race Against Time

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

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.

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.

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).

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.

你是否曾试图向协调员解释:距离比赛开始只剩八小时,却连一道题都还没准备好?米沙就遇到过这种情况。而这一次,他有一个非常强有力的借口:他遭遇了时空悖论!空间与时间彼此互换了。

整个宇宙变成了一块巨大的钟面,上面有三根指针——时针、分针和秒针。时间已然冻结,此时钟面上显示的时间为 hh 小时、mm 分钟、ss 秒。

米沙上一次与协调员交谈是在 t1t_1 点整,因此此刻他正站在钟面上的数字 t1t_1 处。比赛必须在 t2t_2 点整前准备就绪。在这一悖论的语境下,这意味着米沙必须以某种方式到达钟面上的数字 t2t_2。注意,他并非只能向前移动:在此情形下,时间并无方向性。

钟表指针极长,米沙无法从其下方绕行;他也无法跨越指针行走,否则将导致时空坍塌。也就是说,若此时时针指向 12,而米沙站在 11,则他不能沿钟面顶部圆弧直接移动到 1;他必须绕钟面中心完整走一圈(当然,前提是途中没有其他指针阻挡)。

给定三根指针的位置(即 h,m,sh, m, s)、起始位置 t1t_1 和目标位置 t2t_2,请判断米沙能否及时完成比赛准备(或者更准确地说,是“及时空”完成?)。即:判断他能否在钟面上从 t1t_1 移动到 t2t_2。

输入格式

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).

Misha's position and the target time do not coincide with the position of any hand.

五个整数 hh、mm、ss、t1t_1、t2t_2(其中 1 ≤ h ≤ 121 \le h \le 12,0 ≤ m, s ≤ 590 \le m, s \le 59,1 ≤ t1, t2 ≤ 121 \le t_1, t_2 \le 12,且 t1 ≠ t2t_1 \ne t_2)。

米沙所在的位置以及目标时间均不与任何指针的位置重合。

输出格式

Print "YES" (quotes for clarity), if Misha can prepare the contest on time, and "NO" otherwise.

You can print each character either upper- or lowercase ("YeS" and "yes" are valid when the answer is "YES").

如果米沙能按时准备完比赛,则输出 "YES"(引号仅用于明确显示),否则输出 "NO"。

每个字符可以是大写或小写(当答案为 "YES" 时,"YeS" 和 "yes" 均为有效输出)。

输入输出样例

  • 输入#1

    12 30 45 3 11

    输出#1

    NO
  • 输入#2

    12 0 1 12 1

    输出#2

    YES
  • 输入#3

    3 47 0 4 9

    输出#3

    YES

说明/提示

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.

以下三个示例从左到右依次显示在下方图片中。米沙的起始位置用绿色表示,终止位置用粉色表示。注意:图中手部的位置并非完全精确,但已足够接近真实位置,且答案保持不变。

输入解题思路,AI测评打分。不知道怎么写?

首页