显示原始代码
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define pb push_back
int read(int x = 0, int f = 0, char ch = getchar()) {
while (ch < 48 or 57 < ch) f = ch == 45, ch = getchar();
while (48 <= ch and ch <= 57) x = x * 10 + ch - 48, ch = getchar();
return f ? -x : x;
}
typedef double db;
#define fi first
#define se second
void solve() {
int n = read();
db x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
vector<pair<db, int>> a(n + 1);
for (int i = 1; i <= n; i++) {
db x, y;
cin >> x >> y;
a[i].se = i;
if (x < x1)
a[i].fi += (x1 - x) * (x1 - x);
else if (x2 < x)
a[i].fi += (x2 - x) * (x2 - x);
if (y < y1)
a[i].fi += (y1 - y) * (y1 - y);
else if (y2 < y)
a[i].fi += (y2 - y) * (y2 - y);
printf("%.9lf ", sqrt(a[i].fi));
}
sort(a.begin() + 1, a.end());
cout << endl;
cout << a[1].second << endl;
}
signed main() {
solve();
return 0;
}