QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#579461#9320. Find the Easiest ProblemChristinsWA 8ms3756kbC++141022b2024-09-21 13:57:412024-09-21 13:57:42

Judging History

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

  • [2024-09-21 13:57:42]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3756kb
  • [2024-09-21 13:57:41]
  • 提交

answer

#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

void solve() {
    int n;
    std::cin >> n;

    std::unordered_map<int, int> num;
    std::unordered_set<std::string> vis[26];
    for (int i = 0; i < n; i++) {
        char ID;
        std::string team, status;
        
        std::cin >> team >> ID >> status;
        if (!vis[ID - 'A'].count(team) && status == "accepted") {
            vis[ID - 'A'].insert(team);
            num[ID - 'A']++;
        }
    }

    int max = -1;
    for (auto e : num) {
        if (e.second > max) {
            max = e.second;
        }
    }

    int ans = 0;
    for (auto e : num) {
        if (e.second == max) {
            ans = std::min(ans, e.first);
        }
    }

    std::cout << char(ans + 'A') << "\n";
}

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

    int t;
    std::cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

详细

Test #1:

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

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

A
A

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 8ms
memory: 3568kb

input:

1000
44
WaiooyIXa O accepted
WaiooyIXa P accepted
ZYYsNWag P accepted
DPIawQg D rejected
IzPdjnM Z rejected
Ra D rejected
kwQyGxLo I rejected
DPIawQg L accepted
kwQyGxLo I accepted
mmWxDuADCB D rejected
PXwVAOgwiz P rejected
ZYYsNWag U accepted
IzPdjnM Z accepted
TgBNO P rejected
kwQyGxLo J accepted...

output:

A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
...

result:

wrong answer 1st lines differ - expected: 'Z', found: 'A'