码迷,mamicode.com
首页 > Windows程序 > 详细

ural 1147. Shaping Regions

时间:2015-12-26 11:43:24      阅读:256      评论:0      收藏:0      [点我收藏+]

标签:

1147. Shaping Regions

Time limit: 0.5 second
Memory limit: 64 MB
N opaque rectangles (1 ≤ N ≤ 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectangles are put with their sides parallel to the sheet‘s borders. All rectangles fall within the borders of the sheet so that different figures of different colors will be seen.
The coordinate system has its origin (0, 0) at the sheet‘s lower left corner with axes parallel to the sheet‘s borders.

Input

The order of the input lines dictates the order of laying down the rectangles. The first input line is a rectangle “on the bottom”. First line contains AB and N, space separated (1 ≤ AB ≤ 10000). Lines 2, …, N + 1 contain five integers each: llxllyurxury, color: the lower left coordinates and upper right coordinates of the rectangle whose color is color (1 ≤ color ≤ 2500) to be placed on the white sheet. The color 1 is the same color of white as the sheet upon which the rectangles are placed.

Output

The output should contain a list of all the colors that can be seen along with the total area of each color that can be seen (even if the regions of color are disjoint), ordered by increasing color. Do not display colors with no area.

Sample

inputoutput
20 20 3
2 2 18 18 2
0 8 19 19 3
8 0 10 19 4
1 91
2 84
3 187
4 38
 

ural 1147. Shaping Regions

标签:

原文地址:http://www.cnblogs.com/StupidBoy/p/5077647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!