F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Draw a Mess

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1437    Accepted Submission(s): 385


Problem Description
It's graduated season, every students should leave something on the wall, so....they draw a lot of geometry shape with different color.

When teacher come to see what happened, without getting angry, he was surprised by the talented achievement made by students. He found the wall full of color have a post-modern style so he want to have an in-depth research on it.

To simplify the problem, we divide the wall into n*m (1 ¡Ü n ¡Ü 200, 1 ¡Ü m ¡Ü 50000) pixels, and we have got the order of coming students who drawing on the wall. We found that all students draw four kinds of geometry shapes in total that is Diamond, Circle, Rectangle and Triangle. When a student draw a shape in pixel (i, j) with color c (1 ¡Ü c ¡Ü 9), no matter it is covered before, it will be covered by color c.

There are q (1 ¡Ü q ¡Ü 50000) students who have make a drawing one by one. And after q operation we want to know the amount of pixels covered by each color.
 

Input
There are multiple test cases.

In the first line of each test case contains three integers n, m, q. The next q lines each line contains a string at first indicating the geometry shape:

* Circle: given xc, yc, r, c, and you should cover the pixels(x, y) which satisfied inequality (x - xc)2 + (y - yc)2 ¡Ü r2 with color c;
* Diamond: given xc, yc, r, c, and you should cover the pixels(x, y) which satisfied inequality abs(x - xc) + abs(y - yc) ¡Ü r with color c;
* Rectangle: given xc, yc, l, w, c, and you should cover the pixels(x, y) which satisfied xc ¡Ü x ¡Ü xc+l-1, yc ¡Ü y ¡Ü yc+w-1 with color c;
* Triangle: given xc, yc, w, c, W is the bottom length and is odd, the pixel(xc, yc) is the middle of the bottom. We define this triangle is isosceles and the height of this triangle is (w+1)/2, you should cover the correspond pixels with color c;

Note: all shape should not draw out of the n*m wall! You can get more details from the sample and hint. (0 ¡Ü xc, x ¡Ü n-1, 0 ¡Ü yc, y ¡Ü m-1)
 

Output
For each test case you should output nine integers indicating the amount of pixels covered by each color.
 

Sample Input
8 8 4 Diamond 3 3 1 1 Triangle 4 4 3 2 Rectangle 1 1 2 2 3 Circle 6 6 2 4
 

Sample Output
4 4 4 11 0 0 0 0 0
 

Hint

The final distribution of different colors:
00000000
03300000
03310000
00111000
00022240
00002444
00004444
00000444
 

Author
HU, Jun
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-26 20:07:29, Gzip enabled