-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2021s2.cpp
More file actions
36 lines (35 loc) · 846 Bytes
/
2021s2.cpp
File metadata and controls
36 lines (35 loc) · 846 Bytes
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
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <set>
#include <utility>
#include <vector>
int main() {
unsigned long m, n, k;
std::cin >> m >> n >> k;
std::set<std::pair<unsigned long, unsigned long>> map;
for (unsigned long i = 0; i < k; i++) {
char op;
std::cin >> op;
if (op == 'R') {
unsigned long row;
std::cin >> row;
for (unsigned long j = 0; j < m; j++) {
if (map.contains(std::make_pair(j, row))) {
map.erase(std::make_pair(j, row));
} else {
map.insert(std::make_pair(j, row));
}
}
} else if (op == 'C') {
unsigned long column;
std::cin >> column;
for (unsigned long j = 0; j < m; j++) {
if (map.contains(std::make_pair(column, j))) {
map.erase(std::make_pair(column, j));
} else {
map.insert(std::make_pair(column, j));
}
}
}
}
std::cout << map.size() << std::endl;
}