时间又超限了
查看原帖
时间又超限了
1460884
songyihanga楼主2024/11/28 18:00

怎么80呢

超限了吗??????

#include<bits/stdc++.h> 
using namespace std;
int b[1005];
map<string,int>a;
int main(){
	//freopen("a.in","r",stdin);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int m;
		cin>>m;
		if(m==1 or m==2 or m==3){
			string name;
			cin>>name;
			if(m==1){
				int score;
				cin>>score;
				a[name]=score;
				cout<<"OK"<<endl;
			}else{
				if(m==3){
					int pd=0;
					for(auto it=a.begin();it!=a.end();it++){
						string c=it->first;
						if(c==name){
							a.erase(c);
							pd=1;
							cout<<"Deleted successfully"<<endl;
							break;
						}
					}
					if(pd==0){
						cout<<"Not found"<<endl;
					}
				}else{
					if(m==2){
						int pd=0;
						for(auto it=a.begin();it!=a.end();it++){
							string c=it->first;
							int z=it->second;
							if(c==name){
								pd=1;
								cout<<z<<endl;
								break;
							}
						}
						if(pd==0){
							cout<<"Not found"<<endl;
						}
					}
				}
			}
		}else{
			cout<<a.size()<<endl;
		}
	}
}
2024/11/28 18:00
加载中...