QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#723699 | #9544. Grand Prix of Ballance | find | WA | 0ms | 4108kb | C++23 | 1.3kb | 2024-11-07 23:47:01 | 2024-11-07 23:47:01 |
Judging History
answer
#include <bits/stdc++.h>
namespace stdv = std::views;
namespace stdr = std::ranges;
using i64 = long long;
void solve() {
int n, m, q;
scanf("%d%d%d", &n, &m, &q);
std::vector<int> w(n, -1);
std::vector<i64> a(m);
std::vector<std::set<int>> vis(n);
while (q--) {
int o, id, x;
scanf("%d", &o);
if (o == 1) {
scanf("%d", &x);
x--;
w[x] = m;
} else if (o == 2) {
scanf("%d%d", &id, &x);
id--;
x--;
if (vis[x].contains(id) || w[x] == -1) {
continue;
}
vis[x].insert(id);
a[id] += w[x]--;
} else {
scanf("%d%d", &id, &x);
id--;
x--;
if (w[x] == -1) {
continue;
}
vis[x].insert(id);
}
}
std::vector<int> o(m);
std::iota(o.begin(), o.end(), 0);
stdr::sort(o, [&](int i, int j) {
if (a[i] == a[j]) {
return i < j;
}
return a[i] > a[j];
});
for (auto i : o) {
printf("%lld %d\n", i + 1, a[i]);
}
}
auto main() -> int {
int t;
scanf("%d", &t);
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4060kb
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: 4108kb
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'