blob: d6d12620e741d80b3440efaa1d7c7c3526faa03c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
M = int(input())
N = int(input())
K = int(input())
commands = set()
rows = 0
cols = 0
for i in range(K):
a, b = input().split()
c = (a, int(b))
if c in commands:
commands.remove(c)
if a == "R":
rows -= 1
elif a == "C":
cols -= 1
else:
commands.add(c)
if a == "R":
rows += 1
elif a == "C":
cols += 1
print(rows * N + (M - rows) * cols - rows * cols)
|