QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#618963#7879. Colorful Balloonswzxtsl#WA 22ms10036kbC++23651b2024-10-07 12:16:232024-10-07 12:16:25

Judging History

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

  • [2024-10-07 12:16:25]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:10036kb
  • [2024-10-07 12:16:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
const int N=2e5+7;
string ss[N];
void solve(){
    cin>>n;
    string s;
    int ma=0;
    int cnt=0;
    map<string,int> mp;
    for(int i=1;i<=n;i++){
        cin>>ss[i];
        mp[ss[i]]++;
    }
    for(int i=1;i<=n;i++){
        if(mp[ss[i]]>ma){
            cnt=0;
            ma=mp[ss[i]];
            s=ss[i];
        }else if(mp[ss[i]]==ma&&s!=ss[i]){
            cnt=1;
        }
    }
    if(cnt==1){
        cout<<"uh-oh"<<endl;
    }else{
        cout<<s<<endl;
    }
}
signed main(){
    int t=1;
    //cin>>t;
    solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 9776kb

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

score: 0
Accepted
time: 2ms
memory: 9720kb

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

score: 0
Accepted
time: 0ms
memory: 9812kb

input:

1
abc

output:

abc

result:

ok "abc"

Test #4:

score: 0
Accepted
time: 22ms
memory: 10036kb

input:

100000
vagsmrnnry
vagsmrnnry
bvaojtyvmn
vagsmrnnry
vagsmrnnry
vvzrbrqrgb
vagsmrnnry
vvzrbrqrgb
vagsmrnnry
vagsmrnnry
bvaojtyvmn
vagsmrnnry
vagsmrnnry
vvzrbrqrgb
vagsmrnnry
bvaojtyvmn
vagsmrnnry
vagsmrnnry
vagsmrnnry
vvzrbrqrgb
vagsmrnnry
vvzrbrqrgb
vagsmrnnry
vagsmrnnry
vagsmrnnry
vagsmrnnry
vagsmrn...

output:

vagsmrnnry

result:

ok "vagsmrnnry"

Test #5:

score: -100
Wrong Answer
time: 22ms
memory: 9724kb

input:

100000
khccohwxsc
aakazkvryg
khccohwxsc
aakazkvryg
khccohwxsc
khccohwxsc
aakazkvryg
aakazkvryg
khccohwxsc
djckwpxwyt
khccohwxsc
khccohwxsc
djckwpxwyt
khccohwxsc
aakazkvryg
djckwpxwyt
djckwpxwyt
djckwpxwyt
aakazkvryg
djckwpxwyt
aakazkvryg
aakazkvryg
khccohwxsc
aakazkvryg
khccohwxsc
aakazkvryg
aakazkv...

output:

aakazkvryg

result:

wrong answer 1st words differ - expected: 'uh-oh', found: 'aakazkvryg'