QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#718363 | #9544. Grand Prix of Ballance | cgc | WA | 0ms | 3580kb | C++14 | 996b | 2024-11-06 20:20:58 | 2024-11-06 20:20:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
struct node{
ll id;
ll score;
}p[N];
map<int, int>chk;
bool cmp(node x, node y){
if(x.score == y.score) return x.id < y.id;
return x.score > y.score;
}
void slove(){
chk.clear();
int n, m, q;
cin >> n >> m >> q;
for(int i = 1 ; i <= m ; i++){
p[i].id = i;
p[i].score = 0;
}
int type, id, x, now = 0, cnt = 0;
for(int i = 1 ; i <= q ; i++){
cin >> type;
if(type == 1){
cin >> now;
cnt = m;
}
else if(type == 2){
cin >> id >> x;
if(!now) continue;
if(chk[id]) continue;
if(x != now) continue;
chk[id] = x;
p[id].score += cnt;
cnt--;
}
else{
cin >> id >> x;
chk[id] = x;
}
}
sort(p+1, p+m+1, cmp);
for(int i = 1 ; i <= m ; i++) cout << p[i].id << ' ' << p[i].score << '\n';
}
int main(){
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int t;
cin >> t;
while(t--) slove();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3580kb
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 2 4 1 3 3 0 4 0 2 4 1 3 3 0 4 0
result:
wrong answer 5th lines differ - expected: '1 7', found: '2 4'