You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
929 B
36 lines
929 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
int n;
|
||
|
string name;
|
||
|
int opt, score;
|
||
|
|
||
|
unordered_map<string, int> _map;
|
||
|
|
||
|
int main() {
|
||
|
cin >> n;
|
||
|
while (n--) {
|
||
|
cin >> opt;
|
||
|
switch (opt) {
|
||
|
case 1:
|
||
|
cin >> name >> score;
|
||
|
_map[name] = score;
|
||
|
cout << "OK" << endl;
|
||
|
break;
|
||
|
case 2:
|
||
|
cin >> name;
|
||
|
if (_map.count(name) > 0) cout << _map[name] << endl;
|
||
|
else cout << "Not found" << endl;
|
||
|
break;
|
||
|
case 3:
|
||
|
cin >> name;
|
||
|
if (_map.count(name) > 0) _map.erase(name), cout << "Deleted successfully" << endl;
|
||
|
else cout << "Not found" << endl;
|
||
|
break;
|
||
|
case 4:
|
||
|
cout << _map.size() << endl;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|