QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#753657 | #9557. Temperance | ucup-team4801# | WA | 0ms | 3832kb | C++14 | 733b | 2024-11-16 13:23:39 | 2024-11-16 13:23:47 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
const int N=1e5+10;
int n,a[N][3],p[N],mn[N],ans[N];
int main(){
int T,la;scanf("%d",&T);while(T--){
scanf("%d",&n);rep(i,1,n) rep(j,0,2) scanf("%d",&a[i][j]),mn[i]=0;
rep(op,0,2){
iota(p+1,p+n+1,1);sort(p+1,p+n+1,[&](int A,int B){return a[A][op]<a[B][op];});
la=0;rep(i,1,n) if(a[p[i]][op]!=a[p[i+1]][op]) {rep(j,la+1,i) mn[p[j]]=max(mn[p[j]],i-la);la=i;}
}
rep(i,0,n) ans[i]=0;rep(i,1,n) ++ans[mn[i]-1];
per(i,n-1,0) ans[i]+=ans[i+1];
rep(i,0,n-1) printf("%d ",n-ans[i]);puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3832kb
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: 3820kb
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 4 4 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:
wrong answer 45th numbers differ - expected: '0', found: '4'