QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#769606 | #9557. Temperance | XiaoMo247# | WA | 68ms | 12608kb | C++20 | 1.6kb | 2024-11-21 18:30:27 | 2024-11-21 18:30:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct Node {
int x, y, z;
int id, val;
};
struct piv {
vector<int> v;
bool operator < (const piv b) const {
return v.size() > b.v.size();
}
};
bool operator < (vector<int> xx, vector<int> yy) {
return xx.size() > yy.size();
}
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; p[i].val = 3;
max_X = max(max_X, p[i].x); max_Y = max(max_Y, p[i].y); max_Z = max(max_Z, p[i].z);
}
vector<vector<int>> X(max_X + 1, vector<int>()), Y(max_Y + 1, vector<int>()), Z(max_Z + 1,vector<int>());
for (int i = 1; i <= n; i++) {
X[p[i].x].push_back(i); Y[p[i].y].push_back(i); Z[p[i].z].push_back(i);
}
using piv = pair<int, vector<int>>;
priority_queue<vector<int>> pq;
auto inp = [&] (vector<vector<int>> &X) {
for (auto &v : X) {
if (!v.empty())
pq.push(v);
}
};
inp(X), inp(Y), inp(Z);
int res = 0;
for (int k = 1; k <= n; k++) {
while (!pq.empty() && pq.top().size() < k) {
auto v = pq.top(); pq.pop();
for (auto id : v) {
if (--p[id].val == 0) res += 1;
}
}
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: 3552kb
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: 0
Accepted
time: 7ms
memory: 12608kb
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 0 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 0 6 6 0 0 0 0 7 7 7 0 0 0 0 8 8 8 8
result:
ok 72 numbers
Test #3:
score: -100
Wrong Answer
time: 68ms
memory: 3660kb
input:
10000 22 1 4 4 7 2 6 6 5 4 4 4 1 1 7 1 7 6 6 5 8 6 4 4 8 6 7 6 1 7 3 5 7 8 5 1 3 2 1 7 1 2 5 6 1 2 3 1 1 7 3 8 1 4 6 6 5 7 4 4 7 7 7 5 3 4 6 13 2 7 3 2 7 5 5 1 5 8 7 1 6 6 7 3 5 8 8 1 6 4 8 4 1 4 3 6 2 5 6 8 4 1 5 5 5 3 4 28 4 7 2 3 8 5 1 1 6 1 7 4 5 5 6 6 1 5 4 5 2 1 1 5 2 6 3 4 3 6 4 5 7 3 3 6 6 8...
output:
0 0 0 0 2 8 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 0 0 0 6 13 13 13 13 13 13 13 13 13 0 0 0 0 0 0 0 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 0 0 1 9 9 14 14 14 14 14 14 14 14 14 0 0 0 3 7 7 7 19 19 19 19 19 19 19 19 19 19 19 19 0 0 0 0 0 0 0 0 36 36 36 36 36 36 36...
result:
wrong answer 5th numbers differ - expected: '7', found: '2'