QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#871487 | #9557. Temperance | 1903331632 | WA | 1ms | 3712kb | C++23 | 1.1kb | 2025-01-25 20:52:26 | 2025-01-25 20:52:27 |
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 n;
map<int, int> x, y, z;
struct node
{
int xx, yy, zz;
bool operator<(node p) const
{
return max(x[xx], max(y[yy], z[zz])) > max(x[p.xx], max(y[p.yy], z[p.zz]));
}
} tr[N];
void solve()
{
cin >> n;
priority_queue<node> q;
x.clear();
y.clear();
z.clear();
for (int i = 0; i < n; i++)
{
int t1, t2, t3;
cin >> t1 >> t2 >> t3;
x[t1]++;
y[t2]++;
z[t3]++;
tr[i] = {t1, t2, t3};
}
map<int, int> mp;
for (int i = 0; i < n; i++)
{
int mi = max(x[tr[i].xx], max(y[tr[i].yy], z[tr[i].zz]));
mp[mi - 1]++;
}
int res = n;
for (int i = 0; i < n; i++)
{
if (mp[i])
res -= mp[i];
cout << res << ' ';
}
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: 0
Wrong Answer
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:
5 3 0 0 0 0 0 0
result:
wrong answer 1st numbers differ - expected: '0', found: '5'