QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#871270 | #9557. Temperance | 1903331632 | WA | 1ms | 3712kb | C++23 | 1.3kb | 2025-01-25 20:07:00 | 2025-01-25 20:07:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 10;
#define pii pair<int, int>
#define lowbit(x) (x & (-x))
// int x[N], y[N], z[N];
int n;
void solve()
{
cin >> n;
map<int, int> x, y, z;
for (int i = 0; i < n; i++)
{
int t1, t2, t3;
cin >> t1 >> t2 >> t3;
x[t1]++;
y[t2]++;
z[t3]++;
}
priority_queue<int, vector<int>, greater<int>> q1, q2, q3;
int s1 = n;
int s2 = n;
int s3 = n;
for (auto t : x)
q1.push(t.second);
for (auto t : y)
q2.push(t.second);
for (auto t : z)
q3.push(t.second);
for (int i = 0; i < n; i++)
{
while (q1.size() && q1.top() < i + 1)
{
s1 -= q1.top();
q1.pop();
}
while (q2.size() && q2.top() < i + 1)
{
s2 -= q2.top();
q2.pop();
}
while (q3.size() && q3.top() < i + 1)
{
s3 -= q3.top();
q3.pop();
}
cout << n - max(s1, max(s2, s3)) << ' ';
}
cout << endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
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: 3712kb
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 1 1 5 0 0 0 2 6 6 0 0 0 3 7 7 7 0 0 0 0 8 8 8 8 0 0 0 0 0 0 0 0 0 0 0 0 1 1 5 0 0 0 2 6 6 0 0 0 3 7 7 7 0 0 0 0 8 8 8 8
result:
wrong answer 13th numbers differ - expected: '0', found: '1'