QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#753801#9557. Temperanceucup-team059#RE 0ms3852kbC++23815b2024-11-16 13:39:002024-11-16 13:39:02

Judging History

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

  • [2024-11-16 13:39:02]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3852kb
  • [2024-11-16 13:39:00]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

void solve() {

	int n;
	cin >> n;

	vector cnt(3, vector(n + 1, 0));
	vector a(n + 1, array<int, 3>());
	for (int i = 1; i <= n; i ++) {
		for (int j = 0; j < 3; j ++) {
			int x;
			cin >> x;
			a[i][j] = x;
			cnt[j][x] ++;
		}
	}

	vector<int> has;
	for (int i = 1; i <= n; i ++) {
		auto [x, y, z] = a[i];
		has.emplace_back(max({cnt[0][x], cnt[1][y], cnt[2][z]}));
	}

	sort(has.begin(), has.end(), greater<>());

	for (int i = 0; i < n; i ++) {
		while (has.size() && has.back() <= i) {
			has.pop_back();
		}
		cout << n - has.size() << " \n"[i == n - 1];
	}

}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int t;
	cin >> t;
	while (t--) {
		solve();
	}

	return 0;
}

详细

Test #1:

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

input:

2
5
1 1 1
1 1 2
1 1 3
2 3 5
2 2 4
3
1 1 1
2 2 2
3 3 3

output:

0 0 2 5 5
0 3 3

result:

ok 8 numbers

Test #2:

score: -100
Runtime Error

input:

16
1
1 1 1
2
1 1 1
1 1 100000
3
1 1 1
1 1 100000
1 100000 1
4
1 1 1
1 1 100000
1 100000 1
1 100000 100000
5
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
6
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 1 100000
7
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 ...

output:


result: