QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#720896 | #9544. Grand Prix of Ballance | chimu | WA | 0ms | 3844kb | C++17 | 1.8kb | 2024-11-07 14:37:15 | 2024-11-07 14:37:18 |
Judging History
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <stack>
#include <deque>
using namespace std;
bool cmp(pair<int , long> a , pair<int , long> b)
{
if(a.second == b.second) return a.first < b.first;
return a.second > b.second;
}
int main()
{
cin.tie(0),cout.sync_with_stdio(0);
int t;
cin >> t;
while(t--)
{
int n , m , q;
cin >> n >> m >> q;
vector<pair<int , long long>> re(m);
for(int i = 0 ; i < m ; i++) re[i].first = i + 1;
vector<long long> te(m + 1 , -1);
int ju = 0;
while(q--)
{
int type , id , per;
cin >> type;
int now , sc;
if(type == 1)
{
ju = 1;
cin >> id;
now = id;
sc = m;
for(int i = 1 ; i <= m ; i++)
{
if(te[i] != -1) re[i - 1].second += te[i];
te[i] = -1;
}
}
else if(type == 2 && ju)
{
cin >> per >> id;
if(te[per] == -1 && id == now) te[per] = sc--;
}
else if(type == 3 && ju)
{
cin >> per >> id;
if(id == now && te[per] == -1) te[per] = 0;
}
if(!q)
{
for(int i = 1 ; i <= m ; i++)
{
if(te[i] != -1) re[i - 1].second += te[i];
te[i] = -1;
}
}
}
sort(re.begin() , re.end() , cmp);
for(int i = 0 ; i < m ; i++)
{
cout << re[i].first << " " << re[i].second << endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3776kb
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: 3844kb
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 1 0 1 2 2 0 1 0 2 0 1 0 1 0 1 0 2 0 3 0 1 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 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 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0
result:
wrong answer 9th lines differ - expected: '3 7', found: '1 0'