Modern Art is a CCC problem. Notice that if you brush on a specific square for an odd number of times, it ends up being a gold square. If it is even or 0, it is a black square. Using this, we could create a table that has the numbers. Then, for every square in the table, we could add the row and column number. If it is an odd number, the answer will increase by one. At the end, we can add the numbers for the row and column number for every “square”. If that is even, nothing happens. However, if it is odd, a total number increments by one. At the end, output the total.
Answer (python):
rows, columns, times = int(input()), int(input()), int(input())
rows = [0 for _ in range(rows)]
columns = [0 for _ in range(columns)]
for i in range(times):
add = input().split()
if add[0] == 'R':
rows[int(add[1])-1] += 1
else:
columns[int(add[1]) - 1] += 1
total = 0
for r in range(len(rows)):
for c in range(len(columns)):
if (rows[r] + columns[c]) % 2 == 1:
total += 1
print(total)