#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector vint; typedef vector> v2int; typedef vector>> v3int; typedef vector vll; typedef vector> v2ll; typedef vector>> v3ll; typedef list liint; typedef pair pint; typedef vector> vpint; typedef vector> vpll; typedef vector> vpll_int; typedef vector> vpint_ll; typedef set> spint; typedef set> spll; typedef unordered_map> Graph; const int INF = int(2e9); const ll LINF = ll(2e9) * ll(2e9); #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) template void chmax(T& a, C b) { a > b ? : a = b; } template void chmin(T& a, C b) { a < b ? : a = b; } class union_find { private: std::vector parent; std::vector rank; vll size; int node_num; public: union_find(int node_num); void unite(int x, int y); int find(int x); ll get_size(int x); }; union_find::union_find(int node_num) : parent(node_num + 1, 0), rank(node_num + 1, 0), node_num(node_num), size(node_num + 1, 1) { for (int i = 0; i <= node_num; i++) { parent[i] = i; } } void union_find::unite(int x, int y) { int x_root = find(x); int y_root = find(y); if (x_root == y_root) return; if (rank[x_root] > rank[y_root]) { parent[y_root] = x_root; size[x_root] += size[y_root]; } else { parent[x_root] = y_root; if (rank[x_root] == rank[y_root]) { rank[y_root]++; } size[y_root] += size[x_root]; } } ll union_find::get_size(int x) { return size[find(x)]; } int union_find::find(int x) { if (x != parent[x]) { parent[x] = find(parent[x]); } return parent[x]; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N; ll A, B; cin >> N >> A >> B; vll x(N); rep(i, N) cin >> x[i]; union_find uf(N); vector already(N, false); rep(i, N) { if (uf.get_size(i) >= N) continue; //if (already[i] == true) continue; //already[i] = true; auto it = lower_bound(x.begin(), x.end(), x[i] + A); int start = distance(x.begin(), it); it = upper_bound(x.begin(), x.end(), x[i] + B); int end = distance(x.begin(), it); REP(j, start, end) { //if (already[j] == true) continue; already[j] = true; uf.unite(i, j); } it = lower_bound(x.begin(), x.end(), x[i] - B); start = distance(x.begin(), it); it = upper_bound(x.begin(), x.end(), x[i] - A); end = distance(x.begin(), it); REP(j, start, end) { //if (already[j] == true) break; already[j] = true; uf.unite(i, j); } } rep(i, N) { cout << uf.get_size(i) << endl; } return 0; }