QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#797597 | #9544. Grand Prix of Ballance | ucup-team191# | WA | 0ms | 3796kb | C++23 | 978b | 2024-12-03 14:38:28 | 2024-12-03 14:38:28 |
Judging History
answer
#include <bits/stdc++.h>
#define X first
#define Y second
#define PB push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N = 3e5 + 500;
int n, m, q, zad[N];
ll cnt[N];
void solve() {
scanf("%d%d%d", &n, &m, &q);
for(int i = 0;i <= m;i++) cnt[i] = 0, zad[i] = m;
int sad = 0, kol = 0;
for(;q--;) {
int ty; scanf("%d", &ty);
if(ty == 1) {
int x; scanf("%d", &x);
sad = x; kol = m;
} else if(ty == 2) {
int x, id; scanf("%d%d", &id, &x);
if(x == sad && zad[id] != x) {
zad[id] = x;
cnt[id] += kol--;
}
} else {
int x, id; scanf("%d%d", &id, &x);
if(x == sad && zad[id] != x) {
zad[id] = x;
}
}
}
vector < pair<ll, int> > svi;
for(int i = 1;i <= m;i++) svi.PB({cnt[i], i});
sort(svi.rbegin(), svi.rend());
for(auto &[x, id] : svi) printf("%d %lld\n", id, x);
}
int main() {
int T; scanf("%d", &T);
for(;T--;) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3796kb
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 4 0 3 0 1 7 2 4 4 0 3 0 2 4 1 3 4 0 3 0
result:
wrong answer 3rd lines differ - expected: '3 0', found: '4 0'