QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#797597#9544. Grand Prix of Ballanceucup-team191#WA 0ms3796kbC++23978b2024-12-03 14:38:282024-12-03 14:38:28

Judging History

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

  • [2024-12-03 14:38:28]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-12-03 14:38:28]
  • 提交

answer

#include <bits/stdc++.h>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int N = 3e5 + 500;

int n, m, q, zad[N];
ll cnt[N];

void solve() {
	scanf("%d%d%d", &n, &m, &q);
	for(int i = 0;i <= m;i++) cnt[i] = 0, zad[i] = m;
	int sad = 0, kol = 0;
	for(;q--;) {
		int ty; scanf("%d", &ty);
		if(ty == 1) {
			int x; scanf("%d", &x);
			sad = x; kol = m;
		} else if(ty == 2) {
			int x, id; scanf("%d%d", &id, &x);
			if(x == sad && zad[id] != x) {
				zad[id] = x;
				cnt[id] += kol--; 
			}
		} else {
			int x, id; scanf("%d%d", &id, &x);
			if(x == sad && zad[id] != x) {
				zad[id] = x;
			}
		}
	}
	vector < pair<ll, int> > svi;
	for(int i = 1;i <= m;i++) svi.PB({cnt[i], i});
	sort(svi.rbegin(), svi.rend());
	for(auto &[x, id] : svi) printf("%d %lld\n", id, x);
}

int main() {
	int T; scanf("%d", &T);
	for(;T--;) solve();	
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3796kb

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'