QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#576145#7879. Colorful Balloonslibantian#WA 0ms3620kbC++23642b2024-09-19 18:48:072024-09-19 18:48:08

Judging History

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

  • [2024-09-19 18:48:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3620kb
  • [2024-09-19 18:48:07]
  • 提交

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'