QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#722300 | #9544. Grand Prix of Ballance | xh_team# | WA | 1ms | 11964kb | C++14 | 1.9kb | 2024-11-07 18:32:08 | 2024-11-07 18:32:09 |
Judging History
answer
#define TLE ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define int ll
#define inf 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,n,a) for (int i=n;i>=a;i--)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
#define pb push_back
typedef pair<int,int> PII;
// const int mod=1e9+7;
const int mod=998244353;
typedef double db;
mt19937 rnd(time(0));
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const int N = 1e5+5;
int vis[N];
int res[N];
int num[N];
map<int ,bool>mp[N];
struct node
{
int id,w;
}a[N];
signed main(){
TLE;
int t;
cin>>t;
while(t--){
int n,m,q;
cin>>n>>m>>q;
while(q--){
int op;
cin>>op;
if(op==1){
int x;
cin>>x;
vis[x]=1;
}
else {
int x,y;
cin>>x>>y;
if(!vis[y]) continue;
if(mp[x].find(y)!=mp[x].end()) continue;
if(op==2) {
res[x]+=m-num[y];
num[y]++;
}
mp[x][y]=true;
}
}
for(int i=1;i<=m;i++){
a[i].id=i;
a[i].w=res[i];
}
sort(a+1,a+m+1,[](const node &x,node &y){
return x.w>y.w||x.w==y.w&&x.id<y.id;
});
for(int i=1;i<=m;i++){
cout<<a[i].id<<' '<<a[i].w<<'\n';
}
for(int i=1;i<=n;i++){
vis[i]=0;
num[i]=0;
}
for(int i=1;i<=m;i++){
res[i]=0;
mp[i].clear();
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 10024kb
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: 11964kb
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'