#include #include #include #include #include void solve() { int n, a, b; std::cin >> n >> a >> b; std::set xs; std::map xrev; for (int i = 0; i < n; ++i) { int x; std::cin >> x; xs.insert(x); xrev[x] = i; } std::vector ans(n, -1); while (!xs.empty()) { std::vector g; std::queue que; que.push(*xs.begin()); xs.erase(xs.begin()); while (!que.empty()) { int x = que.front(); que.pop(); g.push_back(x); { int l = x - b, r = x - a; auto it = xs.lower_bound(l); while (it != xs.end() && *it <= r) { que.push(*it); it = xs.erase(it); } } { int l = x + a, r = x + b; auto it = xs.lower_bound(l); while (it != xs.end() && *it <= r) { que.push(*it); it = xs.erase(it); } } } for (auto x : g) { ans[xrev[x]] = g.size(); } } for (auto a : ans) std::cout << a << "\n"; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }