QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#755880#9557. TemperanceL__tcode Only (Zhirui Zhu)#WA 0ms3908kbC++202.2kb2024-11-16 18:16:572024-11-16 18:16:59

Judging History

This is the latest submission verdict.

  • [2024-11-16 18:16:59]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3908kb
  • [2024-11-16 18:16:57]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#define ALL(v) v.begin(),v.end()
#define For(i,_) for(int i=0,i##end=_;i<i##end;++i) // [0,_)
#define FOR(i,_,__) for(int i=_,i##end=__;i<i##end;++i) // [_,__)
#define Rep(i,_) for(int i=(_)-1;i>=0;--i) // [0,_)
#define REP(i,_,__) for(int i=(__)-1,i##end=_;i>=i##end;--i) // [_,__)
typedef long long ll;
typedef unsigned long long ull;
#define V vector
#define pb push_back
#define pf push_front
#define qb pop_back
#define qf pop_front
#define eb emplace_back
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
#define fi first
#define se second
const int dir[4][2]={{-1,0},{0,1},{1,0},{0,-1}},inf=0x3f3f3f3f,mod=1e9+7;
const ll infl=0x3f3f3f3f3f3f3f3fll;
template<class T>inline bool ckmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T>inline bool ckmax(T &x,const T &y){return x<y?x=y,1:0;}
int init=[](){return cin.tie(nullptr)->sync_with_stdio(false),0;}();
template<class T>
struct disc{
	// 0-indexed
	vector<T>d;
	inline disc(){}
	inline void insert(const T &x){d.pb(x);}
	inline void insert(const V<T> &v){d.insert(d.end(),ALL(v));}
	inline void init(){sort(ALL(d));d.erase(unique(ALL(d)),d.end());}
	inline disc(const vector<T> &v){d=move(v);init();}
	inline int query(const T &x){return lower_bound(ALL(d),x)-d.begin();}
	inline int size(){return d.size();}
};
int main(){
    int t_case=1;
    scanf("%d",&t_case);
    while(t_case--){
        int n;
        scanf("%d",&n);
        V<int>x(n),y(n),z(n);
        For(i,n)scanf("%d%d%d",&x[i],&y[i],&z[i]);
        disc<int>dx(x),dy(y),dz(z);
        V<int>X(dx.size()),Y(dy.size()),Z(dz.size());
        For(i,n)++X[x[i]=dx.query(x[i])],++Y[y[i]=dy.query(y[i])],++Z[z[i]=dz.query(z[i])];
        V<int>mx(dx.size(),inf),my(dy.size(),inf),mz(dz.size(),inf);
        For(i,n)ckmin(mx[x[i]],max({X[x[i]],Y[y[i]],Z[z[i]]})),ckmin(my[y[i]],max({X[x[i]],Y[y[i]],Z[z[i]]})),ckmin(mz[z[i]],max({X[x[i]],Y[y[i]],Z[z[i]]}));
        V<int>ans(n);
        For(i,n)++ans[min({mx[x[i]],my[y[i]],mz[z[i]]})];
        For(i,n){
            if(i)ans[i]+=ans[i-1];
            printf("%d%c",ans[i]," \n"[i+1==n]);
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3908kb

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: 3796kb

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 4 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 4 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: '4'