为啥全wa
查看原帖
为啥全wa
510360
HbugU楼主2022/4/13 13:44
#include<bits/stdc++.h>
using namespace std;
map<string,int> a;
int n,ans;
int main(){
	cin>>n;
	while(n--){
		int opt;
		string name;
		int s;
		cin>>opt;
		if(opt==1){
			cin>>name>>s;
			if(a[name]==0) ans++;
			a[name]=s;
			cout<<"OK\n";
		}
		if(opt==2){
			cin>>name;
			if(a[name]==0) cout<<"Not found\n";
			else cout<<a[name]<<"\n";
		}
		if(opt==3){
			cin>>name;
			if(a[name]==0) cout<<"Not found\n";
			else{
				cout<<"Deleted successfully\n";
				a[name]=0;
				ans--;
			}
		}
		if(opt==4) cout<<ans;
	}
	return 0;
}
2022/4/13 13:44
加载中...