编程介的小学生 2017-08-26 08:24 采纳率: 0.2%
浏览 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条回答 默认 最新

编辑
预览

报告相同问题?

悬赏问题

  • ¥15 MATLAB解决问题
  • ¥35 哪位专业人士知道这是什么原件吗?哪里可以买到?
  • ¥15 关于#c##的问题:treenode反序列化后获取不到上一节点和下一节点,Fullpath和Handle报错
  • ¥15 一部手机能否同时用不同的app进入不同的直播间?
  • ¥15 没输出运行不了什么问题
  • ¥20 输入import torch显示Intel MKL FATAL ERROR,系统驱动1%,: Cannot load mkl_intel_thread.dll.
  • ¥15 点云密度大则包围盒小
  • ¥15 nginx使用nfs进行服务器的数据共享
  • ¥15 C#i编程中so-ir-192编码的字符集转码UTF8问题
  • ¥15 51嵌入式入门按键小项目