QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#741161 | #9544. Grand Prix of Ballance | CSQ# | WA | 1ms | 5632kb | C++17 | 1.2kb | 2024-11-13 13:38:45 | 2024-11-13 13:38:45 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)(x).size()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll,ll> pii;
const int MAXN = 2e5+5;
pii a[MAXN];
int last[MAXN]; //the last level the players are on
int comp[MAXN]; //whether someone completed this level
int lvl;
int main()
{
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
int tc;
cin>>tc;
while(tc--){
int n,m,q;
cin>>n>>m>>q;
for(int i=1;i<=m;i++){
last[i] = -1;
a[i].se = 0;
a[i].fi = i;
}
for(int i=1;i<=n;i++)comp[i] = 0;
lvl = 0;
for(int i=0;i<q;i++){
int t;
cin>>t;
if(t==1){
int x;
cin>>x;
lvl = x;
}else{
if(!lvl)continue;
int id,x;
cin>>id>>x;
if(x != lvl)continue;
if(last[id] == lvl)continue;
last[id] = lvl;
if(t == 2){
a[id].se += m-1;
if(!comp[lvl]){
comp[lvl] =1;
a[id].se ++;
}
}
}
}
sort(a+1,a+m+1,[&](pii x, pii y){
if(x.se == y.se)return y.fi > x.fi;
return y.se < x.se;
});
for(int i=1;i<=m;i++)cout<<a[i].fi<<" "<<a[i].se<<'\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5632kb
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: 5632kb
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 1 0 1 2 2 0 1 0 2 0 1 0 1 0 1 0 2 0 3 0 1 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 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 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0
result:
wrong answer 9th lines differ - expected: '3 7', found: '1 0'