QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#726549#9544. Grand Prix of Ballanceimwinter#WA 1ms3840kbC++201.3kb2024-11-09 02:39:562024-11-09 02:39:56

Judging History

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

  • [2024-11-09 02:39:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3840kb
  • [2024-11-09 02:39:56]
  • 提交

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;
    }
    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;
        } 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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3828kb

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: 1ms
memory: 3840kb

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 5
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
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
22 0
23 0
24 0
1 0
2 0
...

result:

wrong answer 16th lines differ - expected: '1 3', found: '1 5'