QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#769853 | #9557. Temperance | XiaoMo247# | WA | 0ms | 3536kb | C++20 | 1.0kb | 2024-11-21 19:36:55 | 2024-11-21 19:36:55 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct Node {
int x, y, z;
int id, val;
};
void solve() {
int n; cin >> n;
vector<Node> p(n + 1);
int max_X = 0, max_Y = 0, max_Z = 0;
for (int i = 1; i <= n; i++) {
p[i].id = i; cin >> p[i].x >> p[i].y >> p[i].z;
max_X = max(max_X, p[i].x); max_Y = max(max_Y, p[i].y); max_Z = max(max_Z, p[i].z);
}
map<int, int> X, Y, Z;
for (int i = 1; i <= n; i++) {
X[p[i].x] += 1; Y[p[i].z] += 1; Z[p[i].y] += 1;
}
vector<int> v;
for (int i = 1; i <= n; i++) {
p[i].val = max({X[p[i].x], Y[p[i].y], Z[p[i].z]});
v.push_back(p[i].val);
}
sort(v.begin(), v.end());
int res = 0;
for (int k = 1; k <= n; k++) {
while (res < v.size() && v[res] < k) res ++;
cout << res << " ";
}
cout << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
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: 3532kb
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
Wrong Answer
time: 0ms
memory: 3536kb
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:
0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 0 0 0 1 6 6 0 0 0 0 7 7 7 0 0 0 0 8 8 8 8 0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 0 0 0 1 6 6 0 0 0 0 7 7 7 0 0 0 0 8 8 8 8
result:
wrong answer 19th numbers differ - expected: '0', found: '1'