编程介的小学生 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条回答

报告相同问题?

悬赏问题

  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 如何提取csv文件中需要的列,将其整合为一篇完整文档,并进行jieba分词(语言-python)
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符
  • ¥15 NX MCD仿真与博途通讯不了啥情况
  • ¥15 win11家庭中文版安装docker遇到Hyper-V启用失败解决办法整理
  • ¥15 gradio的web端页面格式不对的问题
  • ¥15 求大家看看Nonce如何配置