
ZOJ Problem Set  3544
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 postmodern style so he want to have an indepth 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. InputThere 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:
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 ≤ n1, 0 ≤ yc, y ≤ m1) OutputFor each test case you should output nine integers indicating the amount of pixels covered by each color. Sample Input8 8 4 Diamond 3 3 1 1 Triangle 4 4 3 2 Rectangle 1 1 2 2 3 Circle 6 6 2 4 Sample Output4 4 4 11 0 0 0 0 0 HintThe final distribution of different colors: Author: HU, Jun Contest: The 2011 ACMICPC Asia Dalian Regional Contest 