QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#677112 | #7879. Colorful Balloons | i0stream | WA | 2ms | 7060kb | C++14 | 487b | 2024-10-26 09:55:27 | 2024-10-26 09:55:27 |
Judging History
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;
}
詳細信息
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