Bomb Game(http://noi.openjudge.cn/ch0201/1661/)
描述
Bosko and Susko are playing an interesting game on a board made of rectangular fields arranged in A rows and B columns.
When the game starts, Susko puts its virtual pillbox in one field one the board. Then Bosko selects fields on which he will throw his virtual bombs. After each bomb, Susko will tell Bosko whether his pillbox is in the range of this bomb or not.
The range of a bomb with diameter P (P is always odd), which is thrown in field (R, S), is a square area. The center of the square is in the field (R, S), and the side of the square is parallel to the sides of the board and with length P.
After some bombs have been thrown, Bosko should find out the position of Susko's pillbox. However, the position may be not unique, and your job is to help Bosko to calculate the number of possible positions.
输入
First line of input contains three integers: A, B and K, 1 <= A, B, K <=100. A represents the number of rows, B the number of columns and K the number of thrown bombs.
Each of the next K lines contains integers R, S, P and T, describing a bomb thrown in the field at R-th row and S-th column with diameter P, 1 <= R <= A, 1 <= S <= B, 1 <= P <= 99, P is odd. If the pillbox is in the range of this bomb, T equals to 1; otherwise it is 0.
输出
Output the number of possible fields, which Susko's pillbox may stay in.
描述
bosko和susko正在一个排列为A行B列的矩形场地上玩一个有趣的游戏。游戏开始,susko在矩形板中的一个字段放入虚拟碉堡,然后bosko选择一个格子投入虚拟炸弹。在每次投弹之后,susko都将告诉bosko它的碉堡是否在炸弹射程内。
炸弹射程边长为p(p总是奇数),在场地投射(R,S),是一个正方形区域,这个正方形的中心是场地上的(R,S),并且正方形的边平行于场地的边,长度为p。
在投射一些炸弹之后,bosko要找出susko的碉堡的位置。但是,这个位置可能不唯一。你的任务便是帮助bosko推测可能的位置的数量。
输入
第一行输入包括三个整数:A、B和K,K<=100.A代表行数,B代表列数,K代表投掷的炸弹数。
在接下来的K行中,每行都包括整数R、S、P和T,来描述一个炸弹投掷在场地的第R行,第S列,边长为P,1<=R<=A,1<=S<=B,1<=P<=99,P是奇数。如果碉堡在炸弹射程范围内,T等于1,不在则为0.
输出
输出susko的碉堡可能的所在位置的数量。