QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#858635 | #9557. Temperance | sshhaarrkk | WA | 1ms | 3584kb | C++14 | 859b | 2025-01-16 19:54:32 | 2025-01-16 19:54:39 |
Judging History
answer
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
const int N=100005;
int x[N],y[N],z[N],a[N];
map<pair<int,int>,int> mp;
int main()
{
int t;
cin>>t;
while (t--)
{
mp.clear();
int n;
cin>>n;
for (int i=0;i<n;i++)
{
cin>>x[i]>>y[i]>>z[i];
mp[{0,x[i]}]++;
mp[{1,y[i]}]++;
mp[{2,z[i]}]++;
}
for (int i=0;i<n;i++)
{
a[i]=max(mp[{0,x[i]}]-1,max(mp[{1,y[i]}]-1,mp[{0,z[i]}]-1));
}
sort(a,a+n);
int ans=0,ai=0;
for (int i=0;i<n;i++)
{
while (ai<n&&a[ai]<i)
{
ans++;
ai++;
}
cout<<ans<<" ";
}
cout<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
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: 3584kb
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 0 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 0 5 0 0 0 0 6 6 0 0 0 0 7 7 7 0 0 0 0 8 8 8 8
result:
wrong answer 14th numbers differ - expected: '1', found: '0'