QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#277002#7879. Colorful BalloonsRachel_in#TL 6ms5192kbC++14477b2023-12-06 14:21:022023-12-06 14:21:02

Judging History

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

  • [2023-12-06 14:21:02]
  • 评测
  • 测评结果:TL
  • 用时:6ms
  • 内存:5192kb
  • [2023-12-06 14:21:02]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
char s[N][15];
int main(){
	int n; scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%s",s[i]);
	for(int i=1;i<=n;i++){
		int cnt=0,len=strlen(s[i]);
		for(int j=i;j<=n;j++){
			int m=strlen(s[j]);
			if(len!=m) continue;
			bool d=1;
			for(int k=0;k<len;k++){
				if(s[i][k]!=s[j][k]){
					d=0; break;
				}
			}
			cnt+=d;
		}
		if(cnt>n/2) return printf("%s",s[i]),0;
	}
	puts("uh-oh");
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

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

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

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

input:

1
abc

output:

abc

result:

ok "abc"

Test #4:

score: 0
Accepted
time: 6ms
memory: 5192kb

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
Time Limit Exceeded

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:


result: