#P9023. [CCC 2021 J5/S2] Modern Art

    ID: 9906 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>模拟2021基础算法CCC(加拿大)

[CCC 2021 J5/S2] Modern Art

Problem Description

Maintain a 0101 matrix, where the initial matrix is all 00.

Each operation flips one row or one column (00 becomes 11, and 11 becomes 00).

Output how many 11's there are in the end.

Input Format

The first line contains MM, the number of rows of the matrix.

The second line contains NN, the number of columns of the matrix.

The third line contains KK, the number of operations.

The next KK lines each contain one character and one number. The character R means operating on a row, and C means a column. The number indicates which row or which column.

Output Format

One line with one number, representing the final number of 11's.

3
3
2
R 1
C 1

4
4
5
7
R 3
C 1
C 2
R 2
R 2
C 1
R 4

10

Hint

Sample explanation:

011           01000
100           01000
100           10111
              10111

Constraints:

1M×N5000000,1K10000001 \leq M\times N\leq 5000000,1 \leq K\leq 1000000

Translated from CCC2021 J5/S2

Translated by ChatGPT 5