QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#568584#9320. Find the Easiest ProblemblackkingRE 1ms3556kbC++14961b2024-09-16 17:12:172024-09-16 17:12:18

Judging History

你现在查看的是最新测评结果

  • [2024-09-16 17:12:18]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:3556kb
  • [2024-09-16 17:12:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int findpro(string s[],int n,string f){
	for(int i=1;i<=n;i++){
		if(s[i]==f)return i;
	}
	return 0;
}
void solve(){
	int n;
	set<string>sum[11];
	string s[11];
	int oi=0;
	cin>>n;
	for(int i=0;i<n;i++){
		string team,pro,from;
		cin>>team>>pro>>from;
		if(from=="rejected")continue;
		if(findpro(s,oi,pro)){
			sum[findpro(s,oi,pro)].insert(team);
		}
		else{
			oi++;
			s[oi]=pro;
			sum[findpro(s,oi,pro)].insert(team);
		}
	}
	int maxnum=0;
	string maxname;
	for(int i=1;i<=n;i++){
		if(sum[i].empty())break;
		if((int)sum[i].size()>maxnum){
			maxnum=sum[i].size();
			maxname=s[i];
		}
		else if((int)sum[i].size()==maxnum&&s[i]<maxname){
			maxnum=sum[i].size();
			maxname=s[i];
		}
	}
	cout<<maxname<<endl;
}
signed main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3556kb

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

A
A

result:

ok 2 lines

Test #2:

score: -100
Runtime Error

input:

1000
44
WaiooyIXa O accepted
WaiooyIXa P accepted
ZYYsNWag P accepted
DPIawQg D rejected
IzPdjnM Z rejected
Ra D rejected
kwQyGxLo I rejected
DPIawQg L accepted
kwQyGxLo I accepted
mmWxDuADCB D rejected
PXwVAOgwiz P rejected
ZYYsNWag U accepted
IzPdjnM Z accepted
TgBNO P rejected
kwQyGxLo J accepted...

output:


result: