欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1989A.Catch the Coin
Catch the Coin
Monocarp visited a retro arcade club with arcade cabinets. There got curious about the "Catch the Coin" cabinet.
The game is pretty simple. The screen represents a coordinate grid such that:
- the X-axis is directed from left to right;
- the Y-axis is directed from bottom to top;
- the center of the screen has coordinates .
At the beginning of the game, the character is located in the center, and coins appear on the screen — the -th coin is at coordinates . The coordinates of all coins are different and not equal to .
In one second, Monocarp can move the character in one of eight directions. If the character is at coordinates , then it can end up at any of the coordinates , , , , , , , .
If the character ends up at the coordinates with a coin, then Monocarp collects that coin.
After Monocarp makes a move, all coins fall down by , that is, they move from to . You can assume that the game field is infinite in all directions.
Monocarp wants to collect at least one coin, but cannot decide which coin to go for. Help him determine, for each coin, whether he can collect it.
Input
The first line contains a single integer () — the number of coins.
In the -th of the next lines, two integers and () are written — the coordinates of the -th coin. The coordinates of all coins are different. No coin is located at .
Output
For each coin, print "YES" if Monocarp can collect it. Otherwise, print "NO".
Note
Pay attention to the second coin in the example. Monocarp can first move from to . Then the coin falls down and ends up at . Finally, Monocarp moves to and collects the coin.
Samples
5
24 42
-2 -1
-1 -2
0 -50
15 0
YES
YES
NO
NO
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |