#1216
Platinum II
TOPOVI
시간 제한
2s
메모리 제한
64MB
제출
1
정답
1
맞힌 사람
1
정답 비율
100.0%

문제

Author: Mislav Balunović

Mirko is a huge fan of chess and programming, but typical chess soon became boring for him, so he started having fun with rook pieces. He found a chessboard with N rows and N columns and placed K rooks on it. Mirko’s game is made of the following rules: 1. Each rook’s power is determined by an integer. 2. A rook sees all the fields that are in his row or column except its own field. 3. We say that a field is attacked if the binary XOR of all the powers of the rooks that see the field is greater than 0. Notice that the field a rook is at can be attacked or not. Initially, Mirko placed the rooks in a certain layout on the board and will make P moves. After each move, determine how many fields are attacked. Every rook can be moved to any free field on the whole board (not only across column and row).

입력

The first line of input contains integers N, K, P (1 ≤ N ≤ 1 000 000 000, 1 ≤ K ≤ 100 000, 1 ≤ P ≤ 100 000). Each of the following K lines contains three integers R, C, X (1 ≤ R, C ≤ N, 1 ≤ X ≤ 1 000 000 000) which denote that initially there is a rook of power X on the field (R, C). Each of the following P lines contains four integers R1, C1, R2, C2 (1 ≤ R1, C1, R2, C2 ≤ N) which denote that the rook has moved from field (R1, C1) to field (R2, C2). It is guaranteed that there will not be two rooks on one field at any point.

출력

The output must consist of P lines, the kth line containing the total number of attacked fields after k moves.

예제 입력 1

2 2 2
1 1 1
2 2 1
2 2 2 1
1 1 1 2

예제 출력 1

4
0

예제 입력 2

2 2 2
1 1 1
2 2 2
2 2 2 1
1 1 1 2

예제 출력 2

4
2

예제 입력 3

3 3 4
1 1 1
2 2 2
2 3 3
2 3 3 3
3 3 3 1
1 1 1 2
3 1 3 2

예제 출력 3

6
7
7
9
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
#순위사용자언어시간메모리코드 길이
8741🥇
백성현
Python684ms67256KB1268B
난이도 투표
Platinum II1명 투표· 3일 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
#사용자문제결과언어시간메모리코드 길이제출 시간
8741
맞았습니다
Python684ms67256KB1268B2026. 06. 03. 08:38