#include #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef vector vb; typedef vector vc; #define INF __INT32_MAX__ #define LINF __LONG_LONG_MAX__ /** * UnionFind(重みなし) */ class UnionFind { private: vector parents; public: UnionFind(long long N) { this->parents = vector(N, -1); } long long size(long long A) { return -1 * parents[this->root(A)]; } long long root(long long A) { if (this->parents[A] < 0) return A; this->parents[A] = this->root(this->parents[A]); return this->parents[A]; } bool unite(long long A, long long B) { long long ra = this->root(A); long long rb = this->root(B); if (ra == rb) return false; if (this->size(ra) > this->size(rb)) { this->parents[ra] += this->parents[rb]; this->parents[rb] = ra; } else { this->parents[rb] += this->parents[ra]; this->parents[ra] = rb; } return true; } bool isUnite(long long A, long long B) { return this->root(A) == this->root(B); } void show() { for (int i = 0; i < this->parents.size(); i++) { this->root(i); // 親の更新を行う cout << "i: " << i << ", parents[i]: " << this->parents[i] << endl; } } }; int main() { ll N, A, B; cin >> N >> A >> B; vl X(N + 2); rep(i, N) cin >> X[i + 1]; X[0] = 0; X[N + 1] = LINF; UnionFind uni(N); for (int i = 0; i < N; i++) { int l = i; int r = N + 2; while (r - l >= 1) { int mid = (l + r) / 2; ll d = X[mid] - X[i + 1]; if (d >= A) { r = mid; } else { l = mid + 1; } } int ra = r; l = i; r = N + 2; while (r - l >= 1) { int mid = (l + r) / 2; ll d = X[mid] - X[i + 1]; if (d > B) { r = mid; } else { l = mid + 1; } } int rb = r; if (0 <= ra && ra