QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#726554#9544. Grand Prix of Ballanceimwinter#RE 0ms0kbC++201.3kb2024-11-09 02:47:272024-11-09 02:47:27

Judging History

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

  • [2024-11-09 02:47:27]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-09 02:47:27]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

void sol() {
    int n, m, q;
    std::cin >> n >> m >> q;

    int a, b ,c;
    int temp = 0, cnt = 0;
    std::vector<std::pair<int, i64>> num(m + 1);
    for (int i = 1; i <= m; i++) {
        num[i].first = i;
        num[i].second = 0;
    }
    std::vector<int> ok(m + 1);
    for (int i = 1; i <= q; i++) {
        std::cin >> a;
        if (a == 1) {
            std::cin >> b;
            temp = b;
            cnt = 0;
            memset(&ok, 0, sizeof ok);
        } else if (a == 2) {
            std::cin >> b >> c;
            if (c == temp && !ok[b]) {
                num[b].second += m - cnt;
                cnt ++;
            }
        } else if (a == 3) {
            std::cin >> b >> c;
            if (c == temp) {
                ok[b] = 1;
            }
        }
    }

    std::sort(num.begin() + 1, num.end(), [](std::pair<int, i64> a, std::pair<int, i64> b){
        if (a.second == b. second) return a.first < b.first;
        return a.second > b.second;
    });

    for (int i = 1; i <= m; i++) {
        std::cout << num[i].first << " " << num[i].second << "\n";
    }
 }

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

    int _;
    std::cin >>_;

    while (_--) {
        sol();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Runtime Error

input:

3
3 4 6
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
3 4 8
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
1 1
2 1 1
3 4 7
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
1 1

output:


result: