QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#730749 | #9544. Grand Prix of Ballance | Arkhell | WA | 1ms | 5712kb | C++14 | 2.1kb | 2024-11-09 21:26:05 | 2024-11-09 21:26:05 |
Judging History
answer
/*
* @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
* @Date: 2024-11-09 21:05:29
* @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
* @LastEditTime: 2024-11-09 21:20:37
* @FilePath: \.vscode\J_Grand_Prix_of_Ballance.cpp
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#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;
fill(cnt, cnt + m + 1, 0);
fill(vis, vis + n + 1, 0);
fill(ans, ans + m + 1, 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];
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;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 5628kb
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: 5712kb
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'