QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#681819#7879. Colorful BalloonsWedonotLikeStudying#WA 21ms3748kbC++23645b2024-10-27 12:09:442024-10-27 12:09:45

Judging History

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

  • [2024-10-27 12:09:45]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:3748kb
  • [2024-10-27 12:09:44]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=(b);a<=(c);a++)
#define per(a,b,c) for(int a=(b);a>=(c);a--)
#define db long double
#define ll long long
using namespace std;

template<class T>inline void read(T &x) {
	T f=1; x=0; char s=getchar();
	while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
	while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
	x*=f;
}

int n,tag;
string s,ans;
map<string,int> cnt;

inline void solve() {
	read(n);
	rep(i,1,n) {
		cin>>s;
		cnt[s]++;
		if((cnt[s]*2)>=n) ans=s,tag=1;
	}
	if(tag) cout<<ans;
	else puts("uh-oh");
}

int main() {
	//int T; read(T); while(T--)
	solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

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

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

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

input:

1
abc

output:

abc

result:

ok "abc"

Test #4:

score: 0
Accepted
time: 21ms
memory: 3748kb

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: 21ms
memory: 3588kb

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'