QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#730818 | #9544. Grand Prix of Ballance | Arkhell | WA | 1ms | 5728kb | C++14 | 1.5kb | 2024-11-09 21:48:17 | 2024-11-09 21:48:17 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int N=1e5+10;
const int MOD=1;
bool cmp(pair<int,int> a, pair<int,int> b){
if(a.second==b.second) return a.first<b.first;
else return a.second>b.second;
}
int cnt[N], vis[N], ans[N];
pair<int, int> p[N];
map<pair<int,int>,int> mp;
void solve() {
int n, m, q;
cin >> n >> m >> q;
for(int i=0;i<=n;i++){
cnt[i]=0;
vis[i]=0;
}
for(int i=0;i<=m;i++){
ans[m]=0;
}
mp.clear();
for(int i=1; i<=q; i++){
int op;
cin >> op;
if(op==1){
int x;
cin >> x;
vis[x]=1;
}else if(op==2){
int id,x;
cin >> id >> x;
if(vis[x]==0 || mp[{id,x}]!=0) continue;
mp[{id,x}]=1; // 完成
ans[id]+=m-cnt[x];
if(cnt[x]!=m){
cnt[x]++;
}
//cnt[x]++;
}else{
int id,x;
cin >> id >> x;
if(vis[x]==0 || mp[{id,x}]!=0) continue;
mp[{id,x}]=2; // 弃权
}
}
for(int i=1; i<=m; i++){
p[i] = {i,ans[i]};
}
sort(p + 1, p + m + 1, cmp); // 排序
for(int i=1; i<=m; i++){
cout << p[i].first << " " << p[i].second << endl;
}
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int _=1;
cin >> _;
while(_--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5728kb
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 10 2 8 3 0 4 0 1 13 2 12 3 0 4 0
result:
wrong answer 5th lines differ - expected: '1 7', found: '1 10'