Logo
(追記) (追記ここまで)

3262번 - BUHA 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB40323280.000%

문제

Boško and Suško are playing an interesting game on a board made of rectangular fields arranged in A rows and B columns.

When the game starts, Suško puts its virtual pillbox on one field the board. Then Boško selects fields on which he will throw his virtual bombs and Suško replies for each bomb if his bunker is in a range.

Range of bomb with diameter P that is thrown on field (R,S) is a rectangle with sides parallel to sides of the board, with field (R,S) in its center and length of each side is P.

Write a program that will help Boško to find out on how many fields could have been placed Suško’s pillbox after some bombs have been thrown.

입력

First line of input file contains three integers: A, B and K, 1 ≤ A,B,K ≤ 100. A represents number of rows, B number of columns and K number of thrown bombs.

Each of the next K lines contains integers R, S, P and T, describing a bomb thrown at the field in Rth row and Sth column with diameter P, 1 ≤ P ≤ 99, P is odd. T equals 1 if the pillbox is in a range if that bomb, otherwise it is 0.

출력

Write to the output file the number of fields on which could have been placed bunker.

제한

예제 입력 1

6 6 2
3 3 3 1
4 4 3 1

예제 출력 1

4

예제 입력 2

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

예제 출력 2

5

예제 입력 3

5 4 1
2 1 5 0

예제 출력 3

8

힌트

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2002 > National Competition #2 - Juniors 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /