#include using ll = long long; using uint = unsigned int; using ull = unsigned long long; using ld = long double; template using max_heap = std::priority_queue; template using min_heap = std::priority_queue, std::greater>; constexpr int popcount(const ull v) { return v ? __builtin_popcountll(v) : 0; } constexpr int log2p1(const ull v) { return v ? 64 - __builtin_clzll(v) : 0; } constexpr int lsbp1(const ull v) { return __builtin_ffsll(v); } constexpr int clog(const ull v) { return v ? log2p1(v - 1) : 0; } constexpr ull ceil2(const ull v) { return 1ULL << clog(v); } constexpr ull floor2(const ull v) { return v ? (1ULL << (log2p1(v) - 1)) : 0ULL; } constexpr bool btest(const ull mask, const int ind) { return (mask >> ind) & 1ULL; } template void bset(T& mask, const int ind) { mask |= ((T)1 << ind); } template void breset(T& mask, const int ind) { mask &= ~((T)1 << ind); } template void bflip(T& mask, const int ind) { mask ^= ((T)1 << ind); } template void bset(T& mask, const int ind, const bool b) { (b ? bset(mask, ind) : breset(mask, ind)); } template bool chmin(T& a, const T& b) { return (a > b ? a = b, true : false); } template bool chmax(T& a, const T& b) { return (a < b ? a = b, true : false); } template constexpr T inf_v = std::numeric_limits::max() / 4; template constexpr Real pi_v = Real{3.141592653589793238462643383279502884}; template constexpr T TEN(const int n) { return n == 0 ? T{1} : TEN(n - 1) * T{10}; } template struct fix : F { fix(F&& f) : F{std::forward(f)} {} template auto operator()(Args&&... args) const { return F::operator()(*this, std::forward(args)...); } }; template auto nd_array(int const (&szs)[n], const T x = T{}) { if constexpr (i == n) { return x; } else { return std::vector(szs[i], nd_array(szs, x)); } } class printer { public: printer(std::ostream& os_ = std::cout) : os{os_} { os << std::fixed << std::setprecision(15); } template int operator()(const T& v) { return os << v, 0; } template int operator()(const std::vector& vs) { for (int i = 0; i < (int)vs.size(); i++) { os << (i ? " " : ""), this->operator()(vs[i]); } return 0; } template int operator()(const std::vector>& vss) { for (int i = 0; i < (int)vss.size(); i++) { os << (0 <= i or i + 1 < (int)vss.size() ? "\n" : ""), this->operator()(vss[i]); } return 0; } template int operator()(const T& v, const Args&... args) { return this->operator()(v), os << ' ', this->operator()(args...), 0; } template int ln(const Args&... args) { return this->operator()(args...), os << '\n', 0; } template int el(const Args&... args) { return this->operator()(args...), os << std::endl, 0; } template int fmt(const std::string& s, const Args&... args) { return rec(s, 0, args...); } private: int rec(const std::string& s, int index) { return os << s.substr(index, s.size()), 0; } template int rec(const std::string& s, int index, const T& v, const Args&... args) { return index == s.size() ? 0 : s[index] == '%' ? (this->operator()(v), rec(s, index + 1, args...)) : (os << s[index], rec(s, index + 1, v, args...)); } std::ostream& os; }; printer out; class scanner { public: scanner(std::istream& is_ = std::cin) : is{is_} { is.tie(nullptr), std::ios::sync_with_stdio(false); } template T val() { T v; return is >> v, v; } template T val(const T offset) { return val() - offset; } template std::vector vec(const int n) { std::vector vs(n); for (auto& v : vs) { v = val(); } return vs; } template std::vector vec(const int n, const T offset) { std::vector vs(n); for (auto& v : vs) { v = val(offset); } return vs; } template std::vector> vvec(const int n0, const int n1) { std::vector> vss(n0); for (auto& vs : vss) { vs = vec(n1); } return vss; } template std::vector> vvec(const int n0, const int n1, const T offset) { std::vector> vss(n0); for (auto& vs : vss) { vs = vec(n1, offset); } return vss; } template auto tup() { return std::tuple...>{val()...}; } template auto tup(const Args&... offsets) { return std::tuple...>{val(offsets)...}; } private: std::istream& is; }; scanner in; # define SHOW(...) static_cast(0) class segments { private: using pii = std::pair; const int ceil; std::vector segs; const int num; public: segments(const int size) : ceil{(int)ceil2(size)}, segs(ceil << 1, pii{0, 0}), num{ceil << 1} { for (int sz = 1; sz <= ceil; sz <<= 1) { const int len = ceil / sz; for (int j = sz; j < (sz << 1); j++) { segs[j] = {len * (j - sz), len * (j - sz + 1)}; } } } std::vector under(int l, int r) const { if (l >= r or r > ceil) { return std::vector{}; } std::vector linds, rinds; for (l += ceil, r += ceil; l < r; l >>= 1, r >>= 1) { if (l & 1) { linds.push_back(l++); } if (r & 1) { rinds.push_back(--r); } } for (; not rinds.empty(); rinds.pop_back()) { linds.push_back(rinds.back()); } return linds; } std::vector over(const int a) const { if (a >= ceil) { return std::vector{}; } std::vector aboves; for (int i = a + ceil; i >= 1; i >>= 1) { aboves.push_back(i); } std::reverse(aboves.begin(), aboves.end()); return aboves; } const pii& operator[](const int i) const { return segs[i]; } int size() const { return num; } }; template struct edge { using cost_type = T; int v; T c; edge(const int v_) : v{v_}, c{1} {} edge(const int v_, const T& c_) : v{v_}, c{c_} {} operator int() const { return v; } int to() const { return v; } T cost() const { return c; } friend std::ostream& operator<<(std::ostream& os, const edge& e) { return os << e.u << "->" << e.v << ":" << e.c; } }; template class base_graph { public: base_graph(const int n) : sz{n}, es(n), res(n) {} void add_edge(const int u, const int v, const bool bi = false) { es[u].emplace_back(v); res[v].emplace_back(u); if (bi) { es[v].emplace_back(u); res[u].emplace_back(v); } } template void add_edge(const int u, const int v, const Cost& c, const bool bi = false) { es[u].emplace_back(v, c); res[v].emplace_back(u, c); if (bi) { es[v].emplace_back(u, c); res[u].emplace_back(v, c); } } std::vector& operator[](const int u) { return es[u]; } const std::vector& operator[](const int u) const { return es[u]; } std::vector& from(const int u) { return es[u]; } const std::vector& from(const int u) const { return es[u]; } std::vector& to(const int v) { return res[v]; } const std::vector& to(const int v) const { return res[v]; } int size() const { return sz; } friend std::ostream& operator<<(std::ostream& os, const base_graph& g) { for (int i = 0; i < g.sz; i++) { for (const auto& e : g.es[i]) { os << e << '\n'; } } return os; } private: int sz; std::vector> es, res; }; using graph = base_graph>; template using cost_graph = base_graph>; template> class sc_comp { public: sc_comp(const base_graph& g) : sz(g.size()), cmp(sz, sz) { std::vector st; std::vector used(sz, false); auto dfs1 = [&](auto&& self, const int s) -> void { used[s] = true; for (const auto& e : g[s]) { const int to = e.to(); if (not used[to]) { self(self, to); } } st.push_back(s); }; auto dfs2 = [&](auto&& self, const int s) -> void { cmp[s] = cnum; for (const auto& e : g.to(s)) { const int to = e.to(); if (cmp[to] != sz) { continue; } self(self, to); } }; for (int i = 0; i < sz; i++) { if (used[i]) { continue; } dfs1(dfs1, i); } for (int i = 0; i < (int)st.size(); i++) { const int s = st[st.size() - i - 1]; if (cmp[s] != sz) { continue; } dfs2(dfs2, s), cnum++; } } int operator[](const int v) const { return cmp[v]; } int comp_num() const { return cnum; } private: int sz, cnum = 0; std::vector cmp; }; template std::pair> top_sort(const base_graph& g) { const int v = g.size(); std::vector srt, used(v, 0); auto dfs = [&](auto&& self, const int s) -> bool { if (used[s] == 1) { return false; } else if (used[s] == 0) { used[s] = 1; for (const auto& e : g[s]) { const int to = e.to(); if (not self(self, to)) { return false; } } used[s] = 2, srt.push_back(s); } return true; }; for (int i = 0; i < v; i++) { if (not dfs(dfs, i)) { return {false, srt}; } } std::reverse(srt.begin(), srt.end()); return {true, srt}; } int main() { const auto N = in.val(); const auto [A, B] = in.tup(); const auto xs = in.vec(N); auto segs = segments(N); const int n = segs.size(); const int h = n / 2; graph g(n); for (int i = 1; i < n; i++) { if (2 * i < n) { g.add_edge(i, i * 2); } if (2 * i + 1 < n) { g.add_edge(i, i * 2 + 1); } } for (int i = 0; i < N; i++) { const int mini1 = std::lower_bound(xs.begin(), xs.end(), xs[i] - B) - xs.begin(); const int supi1 = std::upper_bound(xs.begin(), xs.end(), xs[i] - A) - xs.begin(); if (supi1 - mini1 >= 1) { const auto inds = segs.under(mini1, supi1); for (const int ind : inds) { g.add_edge(i + h, ind); } } const int mini2 = std::lower_bound(xs.begin(), xs.end(), xs[i] + A) - xs.begin(); const int supi2 = std::upper_bound(xs.begin(), xs.end(), xs[i] + B) - xs.begin(); if (supi2 - mini2 >= 1) { const auto inds = segs.under(mini2, supi2); for (const int ind : inds) { g.add_edge(i + h, ind); } } } const sc_comp scc{g}; const int m = scc.comp_num(); std::vector cn(m, 0); for (int i = 0; i < N; i++) { cn[scc[i + h]]++; } graph dag(m); for (int i = 0; i < n; i++) { for (const int to : g[i]) { if (scc[i] != scc[to]) { dag.add_edge(scc[to], scc[i]); } } } const auto is = top_sort(dag).second; std::vector dp(m, 0); for (const int i : is) { dp[i] += cn[i]; for (const int to : dag[i]) { dp[to] += dp[i]; } } for (int i = 0; i < N; i++) { out.ln(dp[scc[i + h]]); } return 0; }