QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#721142 | #9544. Grand Prix of Ballance | chimu | RE | 0ms | 3836kb | C++17 | 1.8kb | 2024-11-07 15:23:49 | 2024-11-07 15:23:50 |
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;
int ju = 0;
while(q--)
{
int type , id , per;
if(!ju) cin >> type;
int now , sc;
if(type == 1 || ju)
{
ju = 1;
cin >> id;
now = id;
sc = m;
int ju2 = 1;
vector<int> s(m + 1 , 0);
while(ju2 && q)
{
cin >> type;
if(type == 1)
{
ju2 = 0;
}
else if(type == 2)
{
q--;
cin >> per >> id;
if(s[per] == 0 && id == now) {re[per - 1].second += sc--; s[per] = 1;}
}
else
{
q--;
cin >> per >> id;
if(s[per] == 0 && id == now) {s[per] = -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: 3836kb
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
Runtime Error
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