QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#792703#9544. Grand Prix of BallanceprokingWA 0ms3792kbC++142.0kb2024-11-29 13:12:242024-11-29 13:12:25

Judging History

你现在查看的是最新测评结果

  • [2024-11-29 13:12:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3792kb
  • [2024-11-29 13:12:24]
  • 提交

answer

#include <bits/stdc++.h>

#define F(i, a, b) for (int i = a; i <= b; i ++)
#define G(i, a, b) for (int i = a; i >= b; i --)
#define outarr(a, L, R) { printf(#a"[%d..%d] = ", L, R); F(i, L, R) W(a[i]), putc(' '); putc('\n'); }
#define out4(x, y, z, w) { printf(#x" = %d", x); printf(" "#y" = %d", y); printf(" "#z" = %d", z), printf(" "#w" = %d", w), putc('\n'); }
#define out3(x, y, z) { printf(#x" = %d", x); printf(" "#y" = %d", y); printf(" "#z" = %d", z), putc('\n'); }
#define out2(x, y) { printf(#x" = %d", x); printf(" "#y" = %d", y); putc('\n'); }
#define out1(x) { printf(#x" = %d\n", x); }
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))
#define mn(a, b) ((a) = min(a, b))
#define mem(a, b) memset(a, b, sizeof a)
#define ll long long
#define pi pair<int, int>
#define get getchar()
#define pb push_back
#define putc putchar
#define pb push_back
#define db double
#define fi first
#define se second

using namespace std;

template <typename Int>
void R(Int &x) {
	char c = get; x = 0; Int t = 1;
	for (; !isdigit(c); c = get) t = (c == '-' ? -1 : t);
	for (; isdigit(c); x = (x << 3) + (x << 1) + c - '0', c = get); x *= t;
}
template <typename Int>
void W(Int x) {
	if (x < 0) { putc('-'); x = - x; }
	if (x > 9) W(x / 10); putc(x % 10 + '0');
}
#define V vector <int>

int T, n, m, q, ty, id, x;

int main() {
//	freopen("data.in","r",stdin);

	for (R(T); T--; ) {
		R(n), R(m), R(q);
		int flag = - 1, res = 0;
		V bz(n + 1), f(n + 1), v;
		F(i, 1, q) {
			R(ty);
			if (ty == 1) {
				for (auto x : v) bz[x] = 0; v.clear();
				R(x), flag = x, res = m;
			}
			if (ty == 2 || ty == 3) {
				R(id), R(x);
				if (x != flag) continue;
				if (bz[id]) continue;
				v.pb(id);
				bz[id] = 1;
				if (ty == 2)
					f[id] += res, res --;
			}
		}
		vector <int> g(m + 1);
		F(i, 1, m) g[i] = i;
		sort(g.begin() + 1, g.end(), [&](int a, int b) {
			return f[a] == f[b] ? a < b : f[a] > f[b];
		});
		F(i, 1, m)
			W(g[i]), putc(' '), W(f[g[i]]), putc('\n');
	}
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

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: 3792kb

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
O 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
11 21879
6 49
16 8
15 6
14 5
13 4
12 2
1 0
2 0
3 0
4 0
5 0
7 0
8 0
9 0
10 -669990896
6 49
1 0
2 0
3 0
4 0
5 0
7 0
8 0
25 170926159
24 170926133
23 170926132
22 170926131
21 170926130
20 170926129
11 21879
18 4113
6 49
16 8
15 7
...

result:

wrong answer 6th lines differ - expected: '6 0', found: 'O 0'