#include "bits/stdc++.h" #define REP(i,num) for(ll i=0;i<(num);++i) #define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i)) #define LOOP(i) while(i--) #define ALL(c) c.begin(),c.end() #define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<& lhs,const pair& rhs){return lhs.c comp rhs.c;} using namespace std; using ll = long long; using vll = vector; using vvll = vector>; constexpr ll atcoder_mod = 1e9+7; template T in(){ T x; cin >> x; return (x); } template> C vecin(int N){ C x(N);REP(i,N){ x[i]=in(); }return x; } void vout(){ cout << endl; } template void vout(Head&& h,Tail&&... t){ cout << ' ' << h;vout(forward(t)...); } void out(){ cout << endl; } template void out(Head&& h,Tail&&... t){ cout << h;vout(forward(t)...); } template bool chmax(T& a,T b){ if(a bool chmin(T& a,T b){ if(a>b){ a=b;return true; }return false; } class RangeUpdate{ public: virtual ll fa(ll x,ll m)=0; virtual ll fm(ll m1,ll m2)=0; ll em; }; class RangeUpdateChange:public RangeUpdate{ public: RangeUpdateChange(){em = numeric_limits::max();} ll fa(ll x,ll m){return m;} ll fm(ll m1,ll m2){return m2;} }; class RangeQuery{ public: virtual ll fx(ll x1,ll x2)=0; virtual ll fp(ll m,ll n)=0; ll ex; }; class RangeQueryMin:public RangeQuery{ public: RangeQueryMin(){ex = numeric_limits::max();} ll fx(ll x1,ll x2){return min(x1,x2);} ll fp(ll m,ll n){return m;} }; class SegmentTree{ unique_ptr range_update; unique_ptr range_query; /* lazy eval */ void Eval(int k,int len){ if(lazy[k]==range_update->em) return; // 更新するものが無ければ終了 if(kfm(lazy[k*2+1],lazy[k]); lazy[k*2+2] = range_update->fm(lazy[k*2+2],lazy[k]); } // 自身を更新 dat[k] = range_update->fa(dat[k],range_query->fp(lazy[k],len)); lazy[k] = range_update->em; } ll Query(ll a, ll b, ll k, ll l, ll r){ Eval(k,r-l); if(r<=a || b<=l){ // 完全に外側の時 return range_query->ex; } else if(a <= l && r <= b){ // 完全に内側の時 return dat[k]; } else{ // 一部区間が被る時 ll vl = Query(a,b,k*2+1,l,(l+r)/2); ll vr = Query(a,b,k*2+2,(l+r)/2,r); return range_query->fx(vl,vr); } } void Update(ll a, ll b, ll x, ll k, ll l, ll r) { Eval(k,r-l); if(a<=l && r<=b){ // 完全に内側の時 lazy[k] = range_update->fm(lazy[k],x); Eval(k,r-l); } else if(afx(dat[k*2+1],dat[k*2+2]); } } public: ll size; vector dat; vector lazy; SegmentTree(ll N, unique_ptr rup,unique_ptr rqp) : range_update(std::move(rup)), range_query(std::move(rqp)){ dat.resize(max(4*N,4ll),range_query->ex); lazy.resize(max(4*N,4ll),range_update->em); ll x = 1; while(N>x) x *= 2; size = x; } void Set(int i,ll x){dat[i+size-1]=x;} ll Get(int i){return dat[i+size-1];} void Build(){ for(ll k=size-2ll;k>=0;k--) dat[k] = range_query->fx(dat[2*k+1],dat[2*k+2]); } void Update(ll a, ll b, ll x){Update(a, b, x, 0, 0, size);} ll Query(int a, int b){return Query(a, b, 0, 0, size);} }; int main(){ cin.tie(0); ios::sync_with_stdio(false); cout<(),make_unique()); REP(i,N){ seg_tree.Set(i,X[i]); } seg_tree.Build(); map C; REP(i,N){ ll L=X[i]+A,R=X[i]+B; auto resL = lower_bound(ALL(X),L); auto resR = upper_bound(ALL(X),R); ll n = distance(resL,resR); ll d = distance(X.begin(),resL)-i; if(!n) continue; ll self = seg_tree.Query(i,i+1); ll to = seg_tree.Query(i+d,i+d+n); seg_tree.Update(i+d,i+d+n,to); if(self M; REP(i,N){ ll V = seg_tree.Get(i); if(C.find(V)!=C.end()){ seg_tree.Set(i,C[V]); } M[seg_tree.Get(i)]++; } REP(i,N){ out(M[seg_tree.Get(i)]); } return 0; }