编程介的小学生 2017-08-26 16:24 采纳率: 20.5%
浏览 829
已采纳

Box Pushing

Karatos needs to push a box through a straight alley. There are some unmovable barriers on the ground. The barriers and the box are all cuboids and their surfaces are parallel or perpendicular to the wall of the alley. Karatos is not allowed to rotate or turn over the box. He does not know whether it is possible to do that. Write a program to tell him the answer.

Since the heights of cuboids are trivial, we can draw the map on an ichnography. Karatos starts from the x-axis. The left wall of alley is just on the y-axis. All barriers are rectangles. No two of them overlap.

Input
The input consists of multiple test cases. Each test case begins with 2 positive integers: L, W which represents the length of the box's projection on x axis and y axis respectively. The second line consists of a positive integer which represents the width of the alley. The third line consists of a non-negative integer N (<=20) which is the number of barriers. The following N lines give out the description of barriers. Each line has 4 non-negative integers: x1, x2, y1, y2, which represents the left, right, front and back sides of the barrier.

Output
For each test case, output "Possible" or "Impossible" in a single line.

Sample Input:
1 1
5
2
1 2 3 4
3 4 1 2
2 2
5
2
1 2 3 4
3 4 1 2
Sample Output:
Possible
Impossible

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?