B. Catch the Coin

    传统题 1000ms 64MiB

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 (0,0) (0, 0) .

At the beginning of the game, the character is located in the center, and n n coins appear on the screen — the i i -th coin is at coordinates (xi,yi) (x_i, y_i) . The coordinates of all coins are different and not equal to (0,0) (0, 0) .

In one second, Monocarp can move the character in one of eight directions. If the character is at coordinates (x,y) (x, y) , then it can end up at any of the coordinates (x,y+1) (x, y + 1) , (x+1,y+1) (x + 1, y + 1) , (x+1,y) (x + 1, y) , (x+1,y1) (x + 1, y - 1) , (x,y1) (x, y - 1) , (x1,y1) (x - 1, y - 1) , (x1,y) (x - 1, y) , (x1,y+1) (x - 1, y + 1) .

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 1 1 , that is, they move from (x,y) (x, y) to (x,y1) (x, y - 1) . 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.

输入格式

The first line contains a single integer n n ( 1n500 1 \le n \le 500 ) — the number of coins.

In the i i -th of the next n n lines, two integers xi x_i and yi y_i ( 50xi,yi50 -50 \le x_i, y_i \le 50 ) are written — the coordinates of the i i -th coin. The coordinates of all coins are different. No coin is located at (0,0) (0, 0) .

输出格式

For each coin, print "YES" if Monocarp can collect it. Otherwise, print "NO".

样例 #1

样例输入 #1

5
24 42
-2 -1
-1 -2
0 -50
15 0

样例输出 #1

YES
YES
NO
NO
YES

提示

Pay attention to the second coin in the example. Monocarp can first move from (0,0) (0, 0) to (1,1) (-1, -1) . Then the coin falls 1 1 down and ends up at (2,2) (-2, -2) . Finally, Monocarp moves to (2,2) (-2, -2) and collects the coin.

题目描述

Monocarp 参观了一个复古街机俱乐部,在那里他对一个名为“捉硬币”游戏机产生了兴趣。

游戏非常简单。屏幕表示一个坐标网格,其中:

  • X 轴从左到右;
  • Y 轴从下到上;
  • 屏幕的中心坐标是 (0,0) (0, 0)

游戏开始时, Monocarp 位于屏幕中心,屏幕上有 n n 个硬币,且第 i i 个硬币位于坐标 (xi,yi) (x_i, y_i) 。所有硬币的坐标都不同,并且不等于 (0,0) (0, 0)

在一秒钟内,Monocarp 可以移动到八个方向之一。如果 Monocarp 在坐标 (x,y) (x, y) ,那么它可以到达以下任意一个坐标:(x,y+1) (x, y + 1) (x+1,y+1) (x + 1, y + 1) (x+1,y) (x + 1, y) (x+1,y1) (x + 1, y - 1) (x,y1) (x, y - 1) (x1,y1) (x - 1, y - 1) (x1,y) (x - 1, y) (x1,y+1) (x - 1, y + 1)

如果 Monocarp 到达有硬币的坐标,则他可以收集该硬币。

在 Monocarp 移动后,所有硬币向下掉落 1 1 ,即它们从 (x,y) (x, y) 移动到 (x,y1) (x, y - 1) 。假设游戏场地在所有方向上都是无限的。

Monocarp 想要收集至少一个硬币,但他无法决定去捡哪个硬币。请帮助他确定,对于每个硬币,他是否可以收集到。

输入格式

第一行包含一个整数 n n ( 1n500 1 \le n \le 500 ),表示硬币的数量。

接下来的 n n 行中,第 i i 行包含两个整数 xi x_i yi y_i ( 50xi,yi50 -50 \le x_i, y_i \le 50 ),表示第 i i 个硬币的横坐标和纵坐标。所有硬币的坐标都不同,且没有硬币位于 (0,0) (0, 0)

输出格式

对于每个硬币,如果 Monocarp 可以收集到它,则输出 "YES"。否则,输出 "NO"。

提示

注意样例中的第二个硬币。Monocarp 可以先从 (0,0) (0, 0) 移动到 (1,1) (-1, -1) 。然后硬币向下掉落 1 1 (2,2) (-2, -2) 。最后 Monocarp 移动到 (2,2) (-2, -2) 并收集硬币。

样例 #1

5
24 42
-2 -1
-1 -2
0 -50
15 0
YES
YES
NO
NO
YES

8月4日编程练习

未参加
状态
已结束
规则
XCPC
题目
3
开始于
2024-8-3 12:00
结束于
2024-8-4 12:00
持续时间
24 小时
主持人
参赛人数
3