编程介的小学生 2017-03-13 01:11 采纳率: 20.5%
浏览 1042
已采纳

Input

In a recent programming contest, one of the problems was about tiling floors with rectangular tiles. The input specification reads like this:

The input contains several floors. The first line of the input gives the number of floors.

Each floor is described in several lines. The first line contains two positive integers: the length and width of the floor, in millimeters. A floor is at most 40 000 mm long or wide. The next line contains a single number: the number t of tiles (1 <= t <= 100). The following t lines each contain the description of a tile. A tile is given as four integers:

xl yl xh yh

where (xl, yl) are the coordinates of the lower left corner of the tile, and (xh, yh) are the coordinates of the upper rightmost corner of the tile. A tile always has a positive area. The order of the coordinates of the floor and those of the tile coincide, of course.

You may assume that the tiles are mutually disjoint, and cover the floor, the whole floor, and nothing but the floor.

The last line of this specification raised some problems. Not for the contestants, but for the judges. Some of the test cases consist of many tiles. How can we be sure that our input file meets this condition? What we need is a checking program that verifies this condition.

Given an input file in the above format, find out for each floor whether the tiles

  1. are disjoint,
  2. do not lie outside the floor,
  3. do cover the floor.

Input

The input contains several floors. The first line of the input gives the number of floors. Each floor is described in several lines. The first line contains two positive integers: the length and width of the floor, in millimeters. A floor is at most 40 000 mm long or wide. The next line contains a single number: the number t of tiles (1 <= t <= 100). The following t lines each contain the description of a tile. A tile is given as four integers:

xl yl xh yh

where (xl, yl) are the coordinates of the lower left corner of the tile, and (xh, yh) are the coordinates of the upper rightmost corner of the tile. A tile always has a positive area. The order of the coordinates of the floor and those of the tile coincide, of course.

Output

For each floor the output contains a single line, containing one of the following words:

NONDISJOINT if overlapping tiles occur;

NONCONTAINED if no overlapping tiles occur, but some tiles go outside the floor;

NONCOVERING if no overlapping tiles occur, and no tiles go outside the floor, but some parts of the floor are not covered;

OK if none of these is true.

Sample Input

4
4 3
2
0 0 2 2
1 1 5 5
4 3
2
0 0 2 2
-2 2 5 5
4 3
2
0 0 2 2
2 0 4 2
4 3
3
0 0 2 2
2 0 4 2
0 2 4 3

Sample Output

NONDISJOINT
NONCONTAINED
NONCOVERING
OK

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-03-23 07:34
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符