#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;

struct Submission {
    string time;
    char problem;
    string team;
    string verdict;
};

bool cmp(const Submission& s1, const Submission& s2) {
    return s1.time < s2.time;
}

bool isAccepted(const Submission& s) {
    return s.verdict == "Accepted";
}

bool isPending(const Submission& s) {
    return s.verdict == "Pending";
}

int main() {
    int n, m, K;
    cin >> n >> m >> K;

    unordered_map<string, int> teamRank;
    vector<vector<int>> teamScore(m, vector<int>(n));
    vector<vector<bool>> teamPending(m, vector<bool>(n));
    vector<Submission> submissions(K);

    for (int i = 0; i < K; ++i) {
        cin >> submissions[i].time >> submissions[i].problem >> submissions[i].team >> submissions[i].verdict;
        --submissions[i].problem; // convert problem char to index
    }

    sort(submissions.begin(), submissions.end(), cmp);

    for (int i = 0; i < K; ++i) {
        const Submission& s = submissions[i];
        if (isAccepted(s)) {
            if (!teamPending[teamRank[s.team]][s.problem]) {
                teamScore[teamRank[s.team]][s.problem] += 1;
                teamPending[teamRank[s.team]][s.problem] = true;
            }
        }
        else if (isPending(s)) {
            if (teamRank.find(s.team) == teamRank.end()) {
                teamRank[s.team] = teamRank.size();
            }
        }
    }

    vector<string> teamOrder;
    for (const auto& p : teamRank) {
        teamOrder.push_back(p.first);
    }

    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < n; ++j) {
            if (teamPending[i][j]) {
                teamScore[i][j] += 20 * count(teamPending[i].begin(), teamPending[i].begin() + j, true);
            }
        }
    }

    vector<int> rank(m, 1);
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < m; ++j) {
            if (i != j) {
                bool isHigher = true;
                for (int k = 0; k < n; ++k) {
                    if (teamScore[i][k] < teamScore[j][k]) {
                        isHigher = false;
                        break;
                    }
                    else if (teamScore[i][k] > teamScore[j][k]) {
                        break;
                    }
                }
                if (isHigher) {
                    ++rank[i];
                }
            }
        }
    }

    for (const string& team : teamOrder) {
        int idx = teamRank[team];
        for (int i = 0; i < rank[idx] - 1; ++i) {
            cout << team << endl;
        }
        if (teamPending[idx] != vector<bool>(n, false)) {
            cout << team << endl;
        }
    }

    return 0;
}
``
用c++解这道题:# 语言月赛202212 打 ACM 最快乐的就是滚榜读队名了Easy Version## 题目背景本题与 I2httpswwwluogucomcnproblemP8890 的题意完全一致区别仅在 $m$ 和 $K$ 的范围。在刚刚结束的 ICPC 杭州赛站上某 E 经历了刺激的滚榜。她发现打 ACM 最快乐的就是滚榜读队名了。## 题目描述一场 ICPC 正式赛共 $5$ 小时

原文地址: http://www.cveoy.top/t/topic/isic 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录