QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#753801 | #9557. Temperance | ucup-team059# | RE | 0ms | 3852kb | C++23 | 815b | 2024-11-16 13:39:00 | 2024-11-16 13:39:02 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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 ...