QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#677112#7879. Colorful Balloonsi0streamWA 2ms7060kbC++14487b2024-10-26 09:55:272024-10-26 09:55:27

Judging History

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

  • [2024-10-26 09:55:27]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:7060kb
  • [2024-10-26 09:55:27]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
const int N=1e5+100;

int n;
string s[N];

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		cin>>s[i];
	}
	s[0]="";
	sort(s+1,s+n+1);
	string mx="";int cur=1,tms=1;
	for (int i=1;i<=n;i++){
		if (s[i]==s[i-1]){
			cur++;
			continue;
		}
		if (cur>tms){
			tms=cur;
			mx=s[i-1];
		}
		cur=1;
	}
	if (cur>tms){
		tms=cur;
		mx=s[n];
	}
	if (tms>n/2) cout<<mx<<endl;
	else puts("uh-oh");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 7060kb

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

score: 0
Accepted
time: 1ms
memory: 7052kb

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 6792kb

input:

1
abc

output:



result:

wrong answer Unexpected EOF in the participants output