QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#786100#7879. Colorful BalloonsaYi_7#WA 20ms3724kbC++17575b2024-11-26 20:19:202024-11-26 20:19:21

Judging History

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

  • [2024-11-26 20:19:21]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:3724kb
  • [2024-11-26 20:19:20]
  • 提交

answer

#include<bits/stdc++.h>


using namespace std;
map<string,int>mp;

int main()
{
    int tt=1;
    //scanf("%d",&tt);
    while(tt--)
    {
        string s;
       int n;
       scanf("%d",&n);
       for(int i=1;i<=n;i++)
       {
          cin>>s;
          mp[s]++;
       }
       string ans;
       int mx=0;
        for(auto [a,b]:mp)
        {
           if(2*b>=n)
           {
              mx=1;
              ans=a;
           }

        }
        if(mx) cout<<ans<<"\n";
        else cout<<"uh-oh"<<"\n";
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

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

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

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

input:

1
abc

output:

abc

result:

ok "abc"

Test #4:

score: 0
Accepted
time: 20ms
memory: 3624kb

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: 20ms
memory: 3592kb

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'