当前位置: 代码迷 >> 综合 >> OpenJudge1661:Bomb Game(翻译 day 6)
  详细解决方案

OpenJudge1661:Bomb Game(翻译 day 6)

热度:85   发布时间:2023-12-05 15:38:30.0

来源:http://noi.openjudge.cn/ch0201/1661/

Bomb Game

总时间限制: 

1000ms

内存限制: 

65536kB

描述

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.

样例输入

5 5 3
3 3 3 1
3 4 1 0
3 4 3 1

样例输出

5

 翻译:Bosko 和 Susko在一个有A行B列组成的矩形棋盘上玩一个有趣的游戏。

当游戏开始时,Susko将他的虚拟碉堡放在棋盘的某一位置,然后Bosko选择一范围扔他的虚拟炸弹。在每一次爆炸之后,Susko将会告诉Bosko是否在爆炸的范围中。

爆炸范围直径为p(p总是奇数),扔炸弹的范围是一个为(R,S)的正方形。正方形的中心在田野(R,S)中,正方形的侧面与棋盘的侧面平行,长度为P.?

在一些炸弹已经被扔之后, Bosko应该找出Susko碉堡的位置,然而这个位置可能不是唯一的,你的任务是帮助Bosko计算出可能位置的数量。

输入:

第一行包含三个整数A,B,和K(1 <= A, B, 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 的药盒可能会保留在里面。?

pillbox 英 [?p?lb?ks] 美 [?p?lbɑ?ks]
n. (士兵的)掩体,隐蔽所,碉堡;

 

  相关解决方案