QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#716326 | #9544. Grand Prix of Ballance | Swd146296# | WA | 1ms | 3628kb | C++17 | 1.7kb | 2024-11-06 14:56:58 | 2024-11-06 14:57:04 |
Judging History
answer
#include<iostream>
#include<vector>
#include<algorithm>
struct pii
{
long long first;
int second;
};
pii make_pair(long long a, int b)
{
pii x;
x.first = a;
x.second = b;
return x;
}
bool operator < (pii a, pii b)
{
if(a.first == b.first)
return a.second < b.second;
return a.first > b.first;
}
pii p[100007];
int n, m, q, _, now, comp;
std::vector<int>sucList, giveupList;
bool suc[100007], giveup[100007];
int main()
{
std::cin >> _;
while(_--)
{
now = 0;
std::cin >> n >> m >> q;
for(int i = 1; i <= m; i++)
{
p[i] = make_pair(0, i);
}
while(q--)
{
int op;
std::cin >> op;
if(op == 1)
{
for(int i = 0; i < sucList.size(); i++)
suc[sucList[i]] = false;
for(int i = 0; i < giveupList.size(); i++)
giveup[giveupList[i]] = false;
sucList.clear();
giveupList.clear();
int x;
std::cin >> x;
now = x;
comp = 0;
}
if(op == 2)
{
int id, x;
std::cin >> id >> x;
if(x != now)
continue;
if(giveup[id])
continue;
p[id].first += m - comp;
comp++;
suc[id] = true;
sucList.push_back(id);
}
if(op == 3)
{
int id, x;
std::cin >> id >> x;
if(x != now)
continue;
if(suc[id])
continue;
giveup[id] = true;
giveupList.push_back(id);
}
}
std::sort(p + 1, p + m + 1);
for(int i = 1; i <= m; i++)
{
std::cout << p[i].second << ' ' << p[i].first << std::endl;
}
for(int i = 0; i < sucList.size(); i++)
suc[sucList[i]] = false;
for(int i = 0; i < giveupList.size(); i++)
giveup[giveupList[i]] = false;
sucList.clear();
giveupList.clear();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3628kb
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: 3536kb
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 6 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 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 22 0 23 0 24 0 1 0 2 0 ...
result:
wrong answer 16th lines differ - expected: '1 3', found: '1 6'