QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#650154#7879. Colorful BalloonsTytytony#WA 20ms3776kbC++23503b2024-10-18 13:29:342024-10-18 13:29:34

Judging History

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

  • [2024-10-18 13:29:34]
  • 评测
  • 测评结果:WA
  • 用时:20ms
  • 内存:3776kb
  • [2024-10-18 13:29:34]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;

int n,MAX=0;
map<string,int> m;
string a;
int tf=-1;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;
		m[a]++;
	} 
	for(auto i=m.begin();i!=m.end();i++){
		MAX=max(MAX,(*i).second);
	}
	for(auto i=m.begin();i!=m.end();i++){
		if((*i).second==MAX){
			tf++;
			a=(*i).first;
		}
	}
	if(tf){
		cout<<"uh-oh\n";
		return 0;
	}
	cout<<a;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3740kb

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

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

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

1
abc

output:

abc

result:

ok "abc"

Test #4:

score: 0
Accepted
time: 17ms
memory: 3592kb

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: 3764kb

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'