0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-14 05:38:47 +00:00
OI-codes/Luogu/P5266/P5266.cpp

37 lines
900 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int main() {
2021-11-19 09:01:13 +00:00
int n, q, a, b;
string s;
map<string, int> students;
cin >> n;
while (n--) {
cin >> q;
if (q == 1) {
cin >> s >> b;
students[s] = b;
cout << "OK" << endl;
2021-11-19 09:01:13 +00:00
} else if (q == 2) {
cin >> s;
if (students.find(s) != students.end()) {
cout << students[s] << endl;
2021-11-19 09:01:13 +00:00
} else {
cout << "Not found" << endl;
}
2021-11-19 09:01:13 +00:00
} else if (q == 3) {
cin >> s;
if (students.find(s) != students.end()) {
students.erase(s);
cout << "Deleted successfully" << endl;
2021-11-19 09:01:13 +00:00
} else {
cout << "Not found" << endl;
}
2021-11-19 09:01:13 +00:00
} else if (q == 4) {
cout << students.size() << endl;
}
}
return 0;
}