编程介的小学生 2017-04-11 09:46 采纳率: 20.5%
浏览 928
已采纳

Unix Robots

Wyest is fond of the game Unix Robots. It is played on a two-dimensional rectangular board. The objective of the game is to escape from a number of robots, which have been programmed with only a single objective: to kill you.

The player character and the robots start at randomly selected grids in the board. Every time the player character moves a square in any direction (horizontally, vertically, or diagonally), so does each robot, in whichever direction is the shortest way. That is, if a robot has two optimal approaches, it will first make |xrobot - xman| and |yrobot - yman| both smaller (move diagonally). (In fact there're robots moving two squares in some sets of Unix Robots, but now we're not considering them.) If the player character collides with a robot, he dies and the game ends. However, the robots are also fatal to each other - when two robots collide, they both die, leaving behind a junkheap. These junkheaps are also fatal to robots.

You can also transport into a grid in cases where moving is otherwise impossible. There're two kinds of transports, one is safe teleport, which has a limit of using, and the other is random. if you have no more safe ones, you'll have to be transported into a randomly selected location, maybe right into the path of a robot.

Generally, the player will gain one safe teleport moving onto the next level, no doubt it's too few. So the Wait button is introduced to you. If you press it, you will no longer be able to move until either all of the robots (which still move towards you) are gone, or you are killed. If you survive finally, each robot will earn you one extra safe teleports to use in future.

Now Wyest is playing the game again, and is asking you to do her a little favor. Given the situation on the board, you only need to tell her whether she can press the Wait button now.

Input

There're multiple test cases. In each test case, the first line contains two integers x and y, coordinates of the grid where the player character is. The second line of a case is an integer n, indicating the number of robots, and n lines follow, each contains two integers xi and yi, coordinates of the grid where roboti is. Then a single line containing an integer m, indicating the number of junkheaps of previous collisions on the board, and m lines follow, each contains two integers xj and yj, coordinates of the grid where junkheapj is.
0 < n <= 100, 0 <= m <= 100. All coordinates between -500000000 and 500000000, and you can safely assume that in each case, no two things are in the same grid initially.

Output

A single line for each case telling whether Wyest can Wait in the current situation, either "YES" or "NO".

Sample Input

0 0
2
3 1
3 -1
0
0 0
1
2 0
1
3 0
Sample Output

YES
NO

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-04-28 15:49
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料