QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#733365#9544. Grand Prix of BallanceSunlight9#WA 0ms3668kbC++201.6kb2024-11-10 18:28:292024-11-10 18:28:29

Judging History

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

  • [2024-11-10 18:28:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3668kb
  • [2024-11-10 18:28:29]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> level_ok(n + 1);
    vector<set<int> > ok(m + 1); //第i个人完成的level
    vector<set<int> > giup(m + 1); //第i个人放弃的level
    vector<ll> pts(n + 1, m); //第i个level的分数
    vector<ll> getp(m + 1); //每个人的分数
    for (int _ = 1; _ <= q; ++_) {
        int ty;
        cin >> ty;
        if (ty == 1) {
            int x;
            cin >> x;
            level_ok[x] = 1;
        } else if (ty == 2) {
            int id, x;
            cin >> id >> x;
            if (!level_ok[x]) continue;
            if (giup[id].count(x) != 0) continue;
            if (ok[id].count(x) != 0) continue;
            getp[id] += pts[x];
            pts[x]--;
            ok[id].insert(x);
        } else {
            int id, x;
            cin >> id >> x;
            if (!level_ok[x]) continue;
            if (giup[id].count(x) != 0) continue;
            if (ok[id].count(x) != 0) continue;
            giup[id].insert(x);
        }
    }
    vector<int> id(m + 1);
    iota(id.begin(), id.end(), 0);
    sort(id.begin() + 1, id.end(), [&](const int x, const int y) {
        if (getp[x] == getp[y]) return x < y;
        return getp[x] > getp[y];
    });

    for (int i = 1; i <= m; ++i) {
        cout << id[i] << " " << getp[id[i]] << "\n";
    }
}

int main() {
    cin.tie(nullptr) -> sync_with_stdio(false);
    
    int _;
    cin >> _;
    while (_--) solve();

    return 0;
}

详细

Test #1:

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

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:

2 4
1 3
3 0
4 0
1 7
2 4
3 0
4 0
2 4
1 3
3 0
4 0

result:

ok 12 lines

Test #2:

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

input:

10
18 8 8
2 1 6
1 13
2 1 18
3 8 13
2 7 14
2 5 11
3 6 13
3 1 13
26 7 11
1 22
2 7 22
1 9
2 6 24
1 2
1 18
3 3 4
2 3 18
1 26
3 7 1
3 2 26
1 3 33
3 3 1
2 3 1
2 2 1
1 1
2 1 1
2 1 1
3 1 1
3 3 1
3 2 1
3 3 1
2 2 1
2 2 1
3 3 1
2 2 1
2 2 1
3 3 1
2 3 1
2 3 1
3 3 1
2 3 1
2 2 1
2 2 1
2 2 1
2 1 1
3 2 1
2 2 1
3 2 1...

output:

1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
3 7
7 7
1 0
2 0
4 0
5 0
6 0
1 3
2 0
3 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
22 25
25 25
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
23 0
24 0
1 0
2 0...

result:

wrong answer 43rd lines differ - expected: '25 25', found: '22 25'