QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#731257 | #9544. Grand Prix of Ballance | rea_lity | WA | 0ms | 3784kb | C++23 | 5.3kb | 2024-11-10 01:11:59 | 2024-11-10 01:11:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define l first
#define r second
#define MYDEBUG //note: close the debug before submit
#ifdef MYDEBUG
#define Debug(X) cout << #X << ": " << X << ";" << endl
template <typename T>
void debug(vector<T>&nums,int len){
if(nums.size() + 1 < len)cout << "Overflow: size of anrry is <" << nums.size() << ">,but len is <" << len << ">" << endl;
else for(int i = 0;i <= len;i++)cout << nums[i] << " \n"[i == len];
}
#else
#define Debug(X)
template <typename T>
void debug(vector<T>&nums,int& len){}
#endif
const int N = 2e5 + 10;
int n,m,q,now_id = 0,sc;
int v[N];
map<int,int>mp;
bool cmp(pair<int,int> a, pair<int,int> b){
if(a.l == b.l)return a.r < b.r;
return a.l > b.l;
}
void solve()
{
cin >> n >> m >> q;
sc = m;
for(int i = 1;i <= q;i++){
int t;cin >> t;
if(t == 1){
cin >> now_id;
sc = m;
mp.clear();
}
else if(t == 2){
int id,scid;cin >> id >> scid;
if(mp[id] == 0 && scid == now_id){
v[id] += sc;
sc --;
}
if(scid == now_id)mp[id] = 1;
}
else{
int id,scid;cin >> id >> scid;
if(scid == now_id)mp[id] = 1;
}
}
vector<pair<int,int> >res;
for(int i = 1;i <= m;i++){
res.push_back({v[i],i});
v[i] = 0;
}
sort(all(res),cmp);
for(int i = 0;i < m;i++){
cout << res[i].r << " " << res[i].l << endl;
}
}
signed main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
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: 3616kb
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: 3784kb
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 25 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 0...
result:
wrong answer 43rd lines differ - expected: '25 25', found: '5 25'