QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#637172#7879. Colorful Balloonsfoolnine#WA 1ms3816kbC++20573b2024-10-13 10:36:042024-10-13 10:36:04

Judging History

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

  • [2024-10-13 10:36:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3816kb
  • [2024-10-13 10:36:04]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

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

    int n;
    cin >> n;

    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        mp[s]++;
    }

    string ans = "uh-on";
    int cnt = 0;
    for (auto [x, y] : mp) {
        if (2 * y >= n) {
            ans = x;
            cnt++;
        }
    }

    if (cnt != 1) {
        ans = "uh-on";
    }

    cout << ans << endl;

    return 0;
}

詳細信息

Test #1:

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

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3560kb

input:

3
red
blue
yellow

output:

uh-on

result:

wrong answer 1st words differ - expected: 'uh-oh', found: 'uh-on'