样例过了却全是wa
查看原帖
样例过了却全是wa
1168995
mkx2023275楼主2024/1/2 17:57
#include<bits/stdc++.h>
using namespace std;
int n,tot;
map<string,int>mp;
int main(){
	//ios::sync_with_stdio(false);
	//cin.tie(0);cout.tie(0);
	cin>>n;
	while(n--){
		int t;
		cin>>t;
		if(t==1){
			string name;
			int score;
			cin>>name>>score;
			mp[name]=score;
			tot++;
			cout<<"OK\n";
		}
		else if(t==2){
			string name;
			cin>>name;
			if(mp[name]) cout<<mp[name]<<'\n';
			else cout<<"Not found\n";
		}
		else if(t==3){
			string name;
			cin>>name;
			if(mp[name]) cout<<"Deleted successfully\n";
			else cout<<"Not found\n";
			mp[name]=0;
			tot--;
		}
		else{
			cout<<tot<<'\n';
		}
	}
	return 0;
}

2024/1/2 17:57
加载中...