QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#734535 | #9544. Grand Prix of Ballance | xly_tyty# | WA | 0ms | 6724kb | C++23 | 1.1kb | 2024-11-11 12:16:56 | 2024-11-11 12:16:57 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int,int> pii;
const int N=1e6+10;
int n,m,a,b,c;
string s;
pii ans[N];
bool vis1[N], vis2[N];
void solve()
{
int n, m, q;cin >>n >> m >> q;
int contest_id = 0;
memset(vis1, 0, sizeof vis1);
memset(vis2, 0, sizeof vis2);
int idx = m;
for (int i = 1; i <= m; i ++) {
ans[i].first = 0;
ans[i].second = i;
}
while(q --) {
int op; cin >> op;
if (op == 1) {
idx = m;
int id ; cin >> id ;
if (vis1[id]) continue ;
contest_id = id;
vis1[id] = 1;
memset(vis2, 0 ,sizeof vis2);
}
if(op == 2) {
int id, x; cin >> id >> x;
if (x != contest_id) continue ;
if (vis2[id]) continue ;
vis2[id] = 1;
ans[id].first += idx -- ;
}
if (op == 3) {
int id, x; cin >> id >> x;
if (x != contest_id ) continue ;
if (vis2[id]) continue ;
vis2[id] = 1;
}
}
sort(ans + 1, ans + 1 + m);
for (int i = m; i >= 1; i --) {
cout << ans[i].second << ' ' << ans[i].first << '\n';
}
return ;
}
signed main()
{
int T;cin>>T;
while(T--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 6724kb
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 4 0 3 0 1 7 2 4 4 0 3 0 2 4 1 3 4 0 3 0
result:
wrong answer 3rd lines differ - expected: '3 0', found: '4 0'