QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#576145 | #7879. Colorful Balloons | libantian# | WA | 0ms | 3620kb | C++23 | 642b | 2024-09-19 18:48:07 | 2024-09-19 18:48:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define all(_a) _a.begin(),_a.end()
void solve(){
int n;
cin>>n;
map<string,int> mp;
for(int i=1;i<=n;i++){
string s;
cin>>s;
mp[s]++;
}
for(auto t:mp){
if(t.se>=(n+1)/2){
cout<<t.fi<<endl;
return;
}
}
cout<<"uh-oh"<<endl;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
int T=1;
cin>>T;
while(T--) solve();
}
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 uh-oh uh-oh uh-oh uh-oh
result:
wrong answer 1st words differ - expected: 'red', found: 'uh-oh'