当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4854:Round-table Conference

题目描述
Round-table conferences were held around the round table, ensuring equal participations for leaders and attendants. It’s a custom holding the belief that “All men are created equal”, derived from the British story of King Arthur and his round table knights.
One day, Zero, as a sponsor holding a round-table conference, faces a tough problem. He knows that there are n groups of people (groups are labeled from 0 to n - 1) and m seats around the table (seats are labeled from 0 to m - 1) in the conference. There are ai people in the i-th group. They should be assigned seats within range (li, (li + 1)%m, (li+ 2)%m, . . . , ri).In a valid arrangment, everyone has a single seat, and no seat can be shared by more than one person. Zero wants to know whether such an arrangement exists.
输入解释
There are several test cases. Please process till EOF.
For each test case, The first line consists two numbers n(1 ≤ n ≤ 105) and m(1 ≤ m ≤ 109). Then follow n lines, each containing three numbers li, ri(0 ≤ li, ri< m) and ai(1 ≤ ai ≤ 109).
输出解释
For each test case, output a single line containing “Yes” if arrangement exists or “No” otherwise.
输入样例
2 4	
0 1 2
1 2 2
2 3	
2 0 2
1 1 1
输出样例
No
Yes
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4854

最后修改于 2020-10-25T23:17:28+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
24000/12000MS(Java/Others) 65536/65536K(Java/Others)