欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF2202A.Parkour Design
Parkour Design
Today, Alex wants to build a parkour course for Steve to train his parkour skills on. A parkour course is a sequence of integer coordinates on the plane. Here, a contiguous pair of coordinates is called a move, denoted as .
Alex knows that Steve can only perform the following types of moves:
- ;
- ;
- .
Note that Steve will not perform any other type of moves. For example, Steve can perform and , but will never perform moves such as , , or (even though they may look very easy).
You are given an integer coordinate on the plane.
Please determine if it is possible to make a parkour course that satisfies the following conditions:
- ;
- ;
- The parkour course only consists of moves that Steve can perform.
Input
Each test contains multiple test cases. The first line contains the number of test cases (). The description of the test cases follows.
The only line of each test case contains two integers and (, ).
Output
If it is possible to make a parkour course that satisfies the conditions, output "YES" on a separate line.
If it is impossible to make a parkour course that satisfies the conditions, output "NO" on a separate line.
You can output the answer in any case. For example, the strings "yEs", "yes", and "Yes" will also be recognized as positive responses.
Note
For the fifth test case, the parkour course must start from and end on .
This can be achieved by the following parkour course.
$$$(0,0) \to (4,-1) \to (7,-1) \to (9,0) \to (12,0) \to (14,1)$$</p><p>Note that the following parkour course <span class="tex-font-style-bf">does not</span> satisfy the third condition stated above due to the moves highlighted in red.</p><p>$$(0,0) \to \color{red}{(4,-1) \to (6,-1)} \to (8,0) \to \color{red}{(11,0) \to (14,1)}$$$Samples
11
2 1
3 0
4 -1
4 1
14 1
1 -4
3 -1
2 10
24 -1
24 -3
8 4
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |