欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1999C.Showering
Showering
As a computer science student, Alex faces a hard challenge — showering. He tries to shower daily, but despite his best efforts there are always challenges. He takes minutes to shower and a day only has minutes!
He already has tasks planned for the day. Task is represented as an interval , , which means that Alex is busy and can not take a shower in that time interval (at any point in time strictly between and ). No two tasks overlap.
Given all time intervals, will Alex be able to shower that day? In other words, will Alex have a free time interval of length at least ?

In the first test case, Alex can shower for the first minutes of the day and not miss any of the tasks.
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains three integers , , and (; ) — the number of time intervals Alex already has planned, the amount of time Alex takes to take a shower, and the amount of minutes a day has.
Then lines follow, the -th of which contains two integers and () — the time interval of the -th task. No two tasks overlap.
Additional constraint on the input: for every .
The sum of over all test cases does not exceed .
Output
For each test case output "YES" (without quotes) if Alex can take a shower for that given test case, and "NO" (also without quotes) otherwise.
You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).
Samples
4
3 3 10
3 5
6 8
9 10
3 3 10
1 2
3 5
6 7
3 3 10
1 2
3 5
6 8
3 4 10
1 2
6 7
8 9
YES
YES
NO
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |