QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#630120#7879. Colorful BalloonsTheliserWA 0ms3824kbC++20594b2024-10-11 16:34:162024-10-11 16:34:21

Judging History

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

  • [2024-10-11 16:34:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3824kb
  • [2024-10-11 16:34:16]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

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

    int n;
    cin >> n;
    map<string, int> mp;
    int mx = -1;
    
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mx = max(mx, ++ mp[s]);
    }
    string res;
    int cnt = 0;
    for (auto &[x, y] : mp) {
        if (y == mx) {
            res = x;
            cnt += 1;
        }
    }
    if (cnt == 1 && mx > 1) {
        cout << res << '\n';
    } else {
        cout << "uh-oh\n";
    }
    return 0;
}

詳細信息

Test #1:

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

input:

5
red
green
red
red
blue

output:

red

result:

ok "red"

Test #2:

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

input:

3
red
blue
yellow

output:

uh-oh

result:

ok "uh-oh"

Test #3:

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

input:

1
abc

output:

uh-oh

result:

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