0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00

P3613 【深基15.例2】寄包柜

R39759186
This commit is contained in:
Baoshuo Ren 2020-10-13 21:08:38 +08:00 committed by Baoshuo Ren
parent d263a9d982
commit 7b818a5baf
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

28
problem/P3613/P3613.cpp Normal file
View File

@ -0,0 +1,28 @@
#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;
while(q--) {
cin >> t >> i >> j;
if(t == 1) {
cin >> k;
if(k == 0) {
if(m.count(i) && m[i].count(j)) {
m[i].erase(k);
if(m[i].empty()) {
m.erase(i);
}
}
} else {
m[i][j] = k;
}
} else if(t == 2) {
cout << m[i][j] << endl;
}
}
return 0;
}