QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#724717 | #9544. Grand Prix of Ballance | ucup-team1001# | WA | 1ms | 3832kb | C++23 | 2.0kb | 2024-11-08 14:41:01 | 2024-11-08 14:41:02 |
Judging History
answer
/*
Author: Haze
*/
#include <bits/stdc++.h>
#define irep(i, l, r) for(int i = (l); i <= (r); ++ i)
#define drep(i, r, l) for(int i = (r); i >= (l); -- i)
#define IOS ios::sync_with_stdio(false), cin.tie(nullptr);
using namespace std;
typedef long long ll;
inline ll readL() {
ll s = 0;
bool fl = false;
char ch = (char) getchar();
while (!isdigit(ch)) {
if (ch == '-')fl = true;
ch = (char) getchar();
}
while (isdigit(ch)) {
s = s * 10 + (ch ^ 48);
ch = (char) getchar();
}
return fl ? -s : s;
}
inline int read() {
return (int) (readL());
}
const int mod = 1000000000 + 7;
const int itinf = 1000000999;
const ll llinf = 2e18;
const int N = 500099;
void solve() {
int n = read(), m = read(), q = read();
vector<int>open(n, -1);
set<array<int, 2>>S;//level player
vector<int>point(m);
while(q --){
int op = read();
if(op == 1){
int x = read();
open[x - 1] = m;
}
if(op == 2){
int id = read() - 1, lev = read() - 1;
if(open[lev] == -1)continue;
if(S.find({lev, id}) != S.end()){
continue;
}
S.insert({lev, id});
point[id] += open[lev];
open[lev] --;
}
if(op == 3){
int id = read() - 1, lev = read() - 1;
if(open[lev] == -1)continue;
if(S.find({lev, id}) != S.end()){
continue;
}
S.insert({lev, id});
}
}
vector<array<int, 2>>ans(m);
irep(i, 0, m - 1){
ans[i] = {point[i], i + 1};
}
sort(ans.begin(), ans.end(), [&](auto A, auto B){
return make_pair(B[0], A[1]) < make_pair( A[0], B[1]);
});
for(auto [u, v] : ans)
cout << v << ' ' << u << '\n';
}
int main() {
// IOS
int T = read();
while (T--) {
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3832kb
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: 3600kb
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 22 25 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 23 0 24 0 1 0 2 0...
result:
wrong answer 43rd lines differ - expected: '25 25', found: '22 25'