QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#726554 | #9544. Grand Prix of Ballance | imwinter# | RE | 0ms | 0kb | C++20 | 1.3kb | 2024-11-09 02:47:27 | 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;
}
详细
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