QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#787352 | #9544. Grand Prix of Ballance | szy10010 | WA | 0ms | 3836kb | C++23 | 1.8kb | 2024-11-27 11:14:16 | 2024-11-27 11:14:29 |
Judging History
answer
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <cmath>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
#define fi first
#define se second
#define u1 (u<<1)
#define u2 (u<<1|1)
#define pb push_back
#define pp pop_back()
#define int long long
#define laile cout<<"laile"<<endl
#define lowbit(x) ((x)&(-x))
#define double long double
#define sf(x) scanf("%lld",&x)
#define sff(x,y) scanf("%lld %lld",&x,&y)
#define sd(x) scanf("%Lf",&x)
#define sdd(x,y) scanf("%Lf %Lf",&x,&y)
#define _for(i,n) for(int i=0;i<(n);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
#define _pre(i,a,b) for(int i=(a);i>=(b);--i)
#define all(x) (x).begin(), (x).end()
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef unsigned long long ULL;
typedef pair<int,int>PII;
typedef pair<double,double>PDD;
const int N=1e6+10,INF=4e18;
int n,m,k,op,level=-1;
bool bl[N];
bool cmp(PII a,PII b)
{
if(a.se==b.se)return a.fi<b.fi;
return a.se>b.se;
}
int res[N];
void solve()
{
cin>>n>>m>>k;
int now;
vector<int>cun;
_rep(i,1,k)
{
int id,nowlevel;
cin>>op;
if(op==1)
{
cin>>level;
now=m;
while(cun.size())
{
bl[cun.back()]=false;
cun.pp;
}
}
else
{
cin>>id>>nowlevel;
if(nowlevel!=level)continue;
if(bl[id])continue;
cun.pb(id);
bl[id]=true;
if(op==3)continue;
res[id]+=now--;
}
}
vector<PII>ans;
_rep(i,1,m)
{
ans.pb({i,res[i]});
res[i]=0;
}
while(cun.size())
{
bl[cun.back()]=false;
cun.pp;
}
sort(all(ans),cmp);
for(auto i:ans)cout<<i.fi<<" "<<i.se<<'\n';
return ;
}
signed main()
{
IOS;
int T=1;
cin>>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: 3836kb
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: 3584kb
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 5 128 25 25 1 0 2 0 3 0 4 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 1 0 2 ...
result:
wrong answer 43rd lines differ - expected: '25 25', found: '5 128'