QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#277659 | #7879. Colorful Balloons | luhanning | WA | 0ms | 3620kb | C++17 | 562b | 2023-12-06 21:16:39 | 2023-12-06 21:16:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+10;
map<string,LL>mp;
string s;
int main()
{
ios::sync_with_stdio(false);cin.tie(nullptr);
LL n;
cin>>n;
LL maxn=0;
string t;
for(int i=1;i<=n;i++)
{
cin>>s;
mp[s]++;
if(mp[s]>maxn)
{
t=s;
maxn=mp[s];
}
if(maxn>=n/2)
{
t=s;
break;
}
}
if(maxn<=n/2)
{
cout<<"uh-oh"<<endl;
}
else cout<<t<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
5 red green red red blue
output:
uh-oh
result:
wrong answer 1st words differ - expected: 'red', found: 'uh-oh'