题源 map的基本操作
#include<bits/stdc++.h>
using namespace std;
int n,op,sc;
string name;
int main()
{
map<string,int>m;
cin>>n;
for(int i=1;i<=n;i++){
cin>>op;
if(op==1){
cin>>name>>sc;
m[name]=sc;
cout<<"OK"<<endl;
}
else if(op==2){
cin>>name;
if(m.find(name)==m.end()){
cout<<"Not found"<<endl;
}
else{
cout<<m[name]<<endl;
}
}
else if(op==3){
cin>>name;
if(m.find(name)==m.end()){
cout<<"Not found"<<endl;
}
else{
m.erase(name);
cout<<"Deleted successfully"<<endl;
}
}
else{
cout<<m.size()<<endl;
}
}
return 0;
}