// LUOGU_RID: 133475449
#include <bits/stdc++.h>
#define pii pair<int, int>
#define X first
#define Y second
using namespace std;
typedef long long i64;
int n, a, b, dis, x[100005], y[100005];
pii A[100005], B[100005];
int fa[100005], cnt[100005], c[100005], id[100005];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }
void solve(int type) {
for (int i = 1; i <= n; ++i) id[i] = i;
sort(id + 1, id + n + 1, [&](int x, int y) { return A[x] < A[y]; });
for (int i = 1; i <= n; ++i) B[i] = A[id[i]];
memset(c, 0, sizeof c);
for (int i = 1; i <= n; ++i) {
int l = lower_bound(B + 1, B + n + 1, make_pair(B[i].X + dis, B[i].Y - dis + type)) - B;
int r = upper_bound(B + 1, B + n + 1, make_pair(B[i].X + dis, B[i].Y + dis - type)) - B - 1;
if (l <= r) {
++c[l], --c[r];
fa[find(id[i])] = find(id[l]);
cnt[id[i]] += r - l + 1;
}
}
for (int i = 1; i < n; ++i) if (c[i] += c[i - 1]) fa[find(id[i])] = find(id[i + 1]);
}
int main(void) {
ios::sync_with_stdio(0);
cin >> n >> a >> b;
for (int i = 1; i <= n; ++i) cin >> x[i] >> y[i], A[i].X = x[i] + y[i], A[i].Y = x[i] - y[i];
dis = abs(x[a] - x[b]) + abs(y[a] - y[b]);
for (int i = 1; i <= n; ++i) fa[i] = i; solve(0);
for (int i = 1; i <= n; ++i) swap(A[i].X, A[i].Y); solve(1);
i64 ans = 0;
for (int i = 1; i <= n; ++i) if (find(i) == find(a)) ans += cnt[i];
cout << ans << "\n";
return 0;
}
Main.cpp: In function ‘int main()’:
Main.cpp:37:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
37 | for (int i = 1; i <= n; ++i) fa[i] = i; solve(0);
| ^~~
Main.cpp:37:45: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
37 | for (int i = 1; i <= n; ++i) fa[i] = i; solve(0);
| ^~~~~
Main.cpp:38:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
38 | for (int i = 1; i <= n; ++i) swap(A[i].X, A[i].Y); solve(1);
| ^~~
Main.cpp:38:56: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
38 | for (int i = 1; i <= n; ++i) swap(A[i].X, A[i].Y); solve(1);
| ^~~~~