#include using namespace std; template using min_priority_queue = priority_queue,greater>; template void printv(vector &v){ bool b = false; for(auto i : v){ if(b) cout << " "; else b = true; cout << i; } cout << endl; } int64_t rand64(){ int64_t l = rand(); int64_t r = rand(); return (l<<31)+r; } template bool chmin(T &a, const T& b) { if (a > b) { a = b; // aをbで更新 return true; } return false; } template bool chmax(T &a, const T& b) { if (a < b) { a = b; // aをbで更新 return true; } return false; } template struct monoid_min{ T val; monoid_min(){ ; } monoid_min(T x){ val = x; } monoid_min e(){ return monoid_min(numeric_limits::max()); } monoid_min operator*(monoid_min other){ if(val < other.val) return monoid_min(val); return other; } bool operator==(monoid_min other){ return val == other.val; } bool operator!=(monoid_min other){ return val != other.val; } }; template struct mapping_add{ monoid val; mapping_add(){ val = monoid().e(); } mapping_add(monoid x){ val = x; } mapping_add id(){ return mapping_add(); } monoid map(monoid s){ return monoid(s*val); } //写像 other*self mapping_add composition(mapping_add other){ return mapping_add(val*other.val); } bool operator==(mapping_add other){ return val == other.val; } bool operator!=(mapping_add other){ return val != other.val; } }; template struct lazySegtree{ int sz; vector dat; vector lazy; lazySegtree(int n){ sz = 1; while(sz <= n) sz *= 2; dat.resize(2*sz-1, monoid().e()); lazy.resize(2*sz-1, mapping().id()); } void eval(int k, int l, int r){ if(lazy[k] != mapping().id()){ dat[k] = lazy[k].map(dat[k]); if(r - l > 1){ lazy[2*k+1] = lazy[2*k+1].composition(lazy[k]); lazy[2*k+2] = lazy[2*k+2].composition(lazy[k]); } } lazy[k] = mapping().id(); return; } void sub_apply(int a, int b, mapping f, int k, int l, int r){ eval(k, l, r); if(b <= l || r <= a) return; if(a <= l && r <= b){ lazy[k] = lazy[k].composition(f); eval(k, l, r); } else{ sub_apply(a, b, f, 2*k+1, l, (l+r)/2); sub_apply(a, b, f, 2*k+2, (l+r)/2, r); dat[k] = dat[2*k+1]*dat[2*k+2]; } return; } void apply(int a, int b, mapping f){ sub_apply(a, b, f, 0, 0, sz); return; } monoid sub_get(int a, int b, int k, int l, int r){ if(b <= l || r <= a) return monoid().e(); eval(k, l, r); if(a <= l && r <= b) return dat[k]; monoid vl = sub_get(a, b, 2*k+1, l, (l+r)/2); monoid vr = sub_get(a, b, 2*k+2, (l+r)/2, r); return vl * vr; } monoid get(int a, int b){ return sub_get(a, b, 0, 0, sz); } }; struct UF { vector par; vector ran; vector sz; UF(int n){ par.resize(n); ran.resize(n); sz.resize(n,1); for(int i = 0; i < n; i++){ par[i] = i; } } int find(int x){ if(par[x] == x) return x; int rtn = find(par[x]); par[x] = rtn; return rtn; } void unite(int x, int y){ x = find(x); y = find(y); if(x == y) return; if(ran[x] < ran[y]){ par[x] = y; sz[y] += sz[x]; } else{ par[y] = x; sz[x] += sz[y]; if(ran[x] == ran[y]){ ran[x]++; } } } bool same(int x, int y){ return find(x) == find(y); } int siz(int x){ return sz[find(x)]; } }; bool yn(bool b){ if(b) cout << "Yes" << endl; else cout << "No" << endl; return b; } bool debug; bool randomInput; bool debugOutput; int numOfTestCase; using ans_type = int; void input(){ if(numOfTestCase > 1){ } if(randomInput){ } else{ } return; } void output_input(){ ; } ans_type calc(){ int N, A, B; cin >> N >> A >> B; int INF = 2001002003; vector X(N+2); X[0] = -INF; X[N+1] = INF; for(int i = 1; i <= N; i++) cin >> X[i]; vector> V(N); for(int i = 0; i < N; i++){ int x = X[i+1]; auto itr1 = lower_bound(X.begin(), X.end(), x - B); auto itr2 = prev(upper_bound(X.begin(), X.end(), x - A)); auto itr3 = lower_bound(X.begin(), X.end(), x + A); auto itr4 = prev(upper_bound(X.begin(), X.end(), x + B)); int a1 = itr1 - X.begin() - 1; int a2 = itr2 - X.begin() - 1; int a3 = itr3 - X.begin() - 1; int a4 = itr4 - X.begin() - 1; V[i] = {a1, a2, a3, a4}; } lazySegtree, mapping_add>> seg(N); for(int i = N-1; i >= 0; i--){ auto[a, b, c, d] = V[i]; b++; d++; chmax(a, 0); chmin(a, N); chmax(b, 0); chmin(b, N); chmax(c, 0); chmin(c, N); chmax(d, 0); chmin(d, N); if(a < b) seg.apply(a, b, mapping_add>(monoid_min(i))); if(c < d) seg.apply(c, d, mapping_add>(monoid_min(i))); } UF U(N); for(int i = 0; i < N; i++){ int j = seg.get(i, i+1).val; if(0 <= j && j < N) U.unite(i, j); } vector ans(N); for(int i = 0; i < N; i++){ ans[i] = U.siz(i); } for(int i : ans) cout << i << endl; return ans_type(); } ans_type calc_simple(){ return ans_type(); } void output(ans_type ans){ return; } int main(){ debug = 0; randomInput = 0; debugOutput = 0; numOfTestCase = 1; srand(time(NULL)); cout << fixed << setprecision(12); if(numOfTestCase == 0) cin >> numOfTestCase; if(debug){ for(int i = 0; i < numOfTestCase; i++){ if(debugOutput) cout << string(16, '-') << endl; input(); ans_type ans = calc(); ans_type ansSimple = calc_simple(); if(ans != ansSimple){ output_input(); output(ans); output(ansSimple); } } } else{ for(int i = 0; i < numOfTestCase; i++){ input(); output(calc()); } } return 0; }