0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-30 19:16:28 +00:00
OI-codes/Luogu/P3613/P3613.cpp

29 lines
618 B
C++
Raw Normal View History

2021-11-19 09:01:13 +00:00
#include <bits/stdc++.h>
using namespace std;
int main() {
map<int, map<int, int> > m;
int n, q, t, i, j, k;
cin >> n >> q;
2021-11-19 09:01:13 +00:00
while (q--) {
cin >> t >> i >> j;
2021-11-19 09:01:13 +00:00
if (t == 1) {
cin >> k;
2021-11-19 09:01:13 +00:00
if (k == 0) {
if (m.count(i) && m[i].count(j)) {
m[i].erase(k);
2021-11-19 09:01:13 +00:00
if (m[i].empty()) {
m.erase(i);
}
}
} else {
m[i][j] = k;
}
2021-11-19 09:01:13 +00:00
} else if (t == 2) {
cout << m[i][j] << endl;
}
}
return 0;
}