B. Race Against Time
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 t1 o'clock, so now he stands on the number t1 on the clock face. The contest should be ready by t2 o'clock. In the terms of paradox it means that Misha has to go to number t2 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, t1, and t2, find if Misha can prepare the contest on time (or should we say on space?). That is, find if he can move from t1 to t2 by the clock face.

Input

Five integers h, m, s, t1, t2 (1 ≤ h ≤ 12, 0 ≤ m, s ≤ 59, 1 ≤ t1, t2 ≤ 12, t1 ≠ t2).

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

Output

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

Examples
Input
12 30 45 3 11
Output
NO
Input
12 0 1 12 1
Output
YES
Input
3 47 0 4 9
Output
YES
Note

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.

说出来你们可能不信,这题到最后我都没做出来。

因为我没根本没有想到,秒针分针时针三个是联动的T T。

(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.主要是这句话误导了我,我以为这句话就是为了强调其实图中的针和刻度是一致的,不用考虑三者的联动)

附事后ac代码:

 1 #include <cstdio>
2 #include <cstring>
3 #include <iostream>
4 #include <string>
5 #include <algorithm>
6 #include <cmath>
7 using namespace std;
8 double nu[5];
9 int main() {
10 ios::sync_with_stdio(false);
11 for(int i = 0; i < 5; i++) {
12 cin>>nu[i];
13 if(i==0||i==3||i==4) nu[i]*=5;
14 if(nu[i]==60) nu[i]=0;
15 }
16 nu[1]+=nu[2]/60;
17 nu[0]+=nu[1]/60;
18 double t1 = min(nu[3],nu[4]);
19 double t2 = max(nu[3],nu[4]);
20 int flag =0;
21 for(int i = 0; i < 3; i++) {
22 if(nu[i] > t1 && nu[i] < t2) flag++;
23
24 }
25 if(flag==3 || flag==0) cout<<"YES"<<endl;
26 else cout<<"NO"<<endl;
27
28 return 0;
29 }

codeforces 868B的更多相关文章

  1. codeforces 868B Race Against Time

    Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a si ...

  2. codeforces 868B The Eternal Immortality【暴力+trick】

    B. The Eternal Immortality time limit per test 1 second memory limit per test 256 megabytes input st ...

  3. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  4. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  5. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  6. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  7. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  8. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  9. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

随机推荐

  1. 十一、UART&TTY驱动

    Linux系统中UART驱动和TTY驱动两者有着紧密的关系,它们不像I2C和SPI驱动是单独一个模块,分析时应当将它们看成一个整体来分析.UART驱动部分依赖于硬件平台,而TTY驱动和具体的平台无关. ...

  2. python爬虫如何提高效率

    开启线程池: 线程池 asyncio 特殊的函数 协程 任务对象 任务对象绑定 事件循环 from multiprocessing.dummy import Pool map(func,alist): ...

  3. Flask之路由系统

    路由系统 路由的两种写法 1.第一种方法: def index(): return render_template('index.html') app.add_url_rule('/index', ' ...

  4. 使用jiffies的时间比较函数time_after、time_before

    1. jiffies简介 首先,操作系统有个系统专用定时器(system timer),俗称滴答定时器,或者系统心跳. 全局变量jiffies取值为自操作系统启动以来的时钟滴答的数目,在头文件< ...

  5. CF413C

    正文 题意: 给 n 个关卡,每个关卡得分为 ai,有 m 次机会可以选择一 个关卡通过后不得分,而将现有得分翻倍 你可以安排关卡的通过顺序和策略,求最大得分. 分析: 看到这道题首先想到的就是贪心, ...

  6. 90% 的 Java 程序员都说不上来的为何 Java 代码越执行越快(1)- JIT编译优化

    麻烦大家帮我投一票哈,谢谢 经常听到 Java 性能不如 C/C++ 的言论,也经常听说 Java 程序需要预热,那么其中主要原因是啥呢? 面试的时候谈到 JVM,也有很多面试官喜欢问,为啥 Java ...

  7. Python 学习博客地址

    Alex  https://www.cnblogs.com/alex3714林海峰 https://www.cnblogs.com/linhaifeng武佩奇 https://www.cnblogs. ...

  8. 提供读取excel 的方法

    /** * 对外提供读取excel 的方法 * */ public static List<List<Object>> readExcel(String path) throw ...

  9. NodeRED - 全局变量的使用笔记

    NodeRED - 全局变量的使用笔记 global global.get(..) :获取全局范围的上下文属性 global.set(..) :设置全局范围的上下文属性 global.keys(..) ...

  10. springboot中扩展ModelAndView实现net mvc的ActionResult效果

    最近在写spring boot项目,写起来感觉有点繁琐,为了简化spring boot中的Controller开发,对ModelAndView进行简单的扩展,实现net mvc中ActionResul ...