QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501842#7879. Colorful BalloonsjayketWA 5ms3788kbC++23636b2024-08-02 23:22:292024-08-02 23:22:29

Judging History

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

  • [2024-08-02 23:22:29]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3788kb
  • [2024-08-02 23:22:29]
  • 提交

answer

#include<bits/stdc++.h>

using i64 = int64_t;
using u64 = uint64_t;
using f64 = long double;

#ifndef ONLINE_JUDGE
#include "algo\debug.hpp"
#else
#define debug(...) (void)42
#endif

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	std::cout << std::fixed << std::setprecision(13);

	int n;
	std::cin >> n;

	std::map<std::string, int>rec;
	for (int i = 1; i <= n; i += 1) {
		std::string s;
		std::cin >> s;
		rec[s] += 1;
	}

	for (const auto & [x, v] : rec) {
		if (2 * v >= n) {
			std::cout << x << "\n";
			return 0;
		}
	}

	std::cout << "uh-oh\n";

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

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

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

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

input:

1
abc

output:

abc

result:

ok "abc"

Test #4:

score: 0
Accepted
time: 5ms
memory: 3564kb

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: 5ms
memory: 3788kb

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'