#include <iostream>
#include <unordered_map>
#include <string>
using namespace std;
//利用哈希表键为玩家名,值为积分
unordered_map<string , int> gamePlayer;
void insertOrUpdateScore(const string &name, int score)
{
// TODO: 实现插入或更新逻辑
gamePlayer[name] = score;
cout << "OK" <<endl;
}
void queryScore(const string &name)
{
// TODO: 实现查询逻辑
if (gamePlayer.count(name)){
cout << gamePlayer[name]<<endl;
}else {
cout <<"Not found"<<endl;
}
}
void deletePlayer(const string &name)
{
// TODO: 实现删除逻辑
if (gamePlayer.count(name)){
gamePlayer.erase(name);
cout <<"Deleted successfully"<<endl;
}else {
cout <<"Not found"<<endl;
}
}
void countPlayers()
{
// TODO: 实现统计逻辑
// for (auto it = gamePlayer.begin(); it != gamePlayer.end(); it ++){
// sum++;
// }
cout << gamePlayer.size() <<endl;
}
int main()
{
// 提高输入输出效率 (可选)
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int q;
cin >> q;
while (q--)
{
int op;
cin >> op;
if (op == 1)
{
string name;
int score;
cin >> name >> score;
insertOrUpdateScore(name, score);
}
else if (op == 2)
{
string name;
cin >> name;
queryScore(name);
}
else if (op == 3)
{
string name;
cin >> name;
deletePlayer(name);
}
else if (op == 4)
{
countPlayers();
}
}
return 0;
}