当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1543:Paint the Wall

题目描述
Here comes our future artist. See, he is painting again, this time on home's white wall, using different color of paint. Let me see, red, yellow, black, green... but why does he just paint rectangles? Pretty guy, seems he is fond of it.

So, after he's done his great job, the white wall has been filled with so many blocks of color. Of course, some color previously painted has been covered by some color painted later. Now, the little guy has some doubt that how many different colors have been left on the wall, and what are the areas of them. As a seven-year-old boy, he has just learned painting in kindergarten, math seems too difficult for him. So he turns to you, a college student good at math and programming, to help him figuring it out. Don't make him disappointed.
输入解释
Input consists of multiple test cases, each describing "a great job" done by out little guy.

Each case begins with a line containing two integers, Height and Width, the size of the wall. The next line contains an integer N, which is the number of rectangles that have been painted. N lines follow, describing the rectangles in the order they were painted. Each line contains five integers, Top, Left, Bottom, Right, and Color, giving out the position, size and color information of the rectangle.

The range of Height and Width is [1, 10000]. There will be at least 1, and at most 100 rectangles to be painted. For each rectangle, Top and Bottom is in the range [0, Height], Left and Right is in the range [0, Width]. Bottom is strictly greater than Top, and Right is strictly greater than Left. Color will be in the range [1, 100].

The top-left coordinate of the wall is (0, 0), and the bottom-right coordinate of the wall is (Height, Width), as shown below.


(0,0) (0,W)
---------------
| |
| |
| |
| |
| |
---------------
(H,0) (H,W)



The last case is followed by a line containing two zeroes.

There is a blank line between two test cases.
输出解释
For each painting, first output "Case X:" in a single line where X is the case number starting form 1. Then output the colors left and their areas, one color per line, in the order of color numbers (increasing). For each color, you should output the color number, a blank space, and the area of this color on the wall. After that, you should output a single line "There is M color left on the wall." or "There are M colors left on the wall.", depending on M, which is the number of colors left on the wall.

Output a blank line between two test cases.
输入样例
10 5
1
1 1 2 2 2

4 4
2
0 0 3 3 1
2 2 4 4 2

0 0
输出样例
Case 1:
2 1
There is 1 color left on the wall.

Case 2:
1 8
2 4
There are 2 colors left on the wall.
来自杭电HDUOJ的附加信息
Author DAI, Wenbin
Recommend linle

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1543

最后修改于 2020-10-25T22:45:54+00:00 由爬虫自动更新

共提交 131

通过率 64.12%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)