原题链接
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
double sq[7];
int vis[7];
double dis[7][7];
int n;
int x, y, xx, yy;
pii a[7];
double mi_dis[7];
double diss(int x, int y,int xx,int yy){
return sqrt(abs(x -xx) * abs(x -xx) + abs(y - yy) * abs(y - yy));
}
double circ(double r){
return r * r * 3.1415;
}
double ans = 0;
void dfs(int now,double sum,int cnt){
if(cnt == n){
ans = max(ans, sum);
return;
}
for(int i = 1 ; i <= n; i++){
if(!vis[i]){
double mi = mi_dis[i];
for(int j = 1; j <= n; j++)
if(vis[j] == 1)
mi = min(mi, dis[i][j] - sq[j]);
for(int j = 1; j <= n; j++)
if(!vis[j] && dis[i][j] <= mi)
vis[j] = 2;
sq[i] = mi;
vis[i] = 1;
dfs(i, sum + circ(mi), cnt + 1);
vis[i] = 0;
sq[i] = 0;
for(int j = 1; j <= n; j++)
if(!vis[j] && dis[i][j] <= mi)
vis[j] = 0;
}
}
}
int xa,xb,ya,yb;
int main(){
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n;
cin >> x >> y >> xx >> yy;
x += 1000, y += 1000;
xx += 1000, yy += 1000;
for(int i = 1; i <= n; i++){
cin >> a[i].first >> a[i].second;
a[i].first += 1000, a[i].second += 1000;
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
if(i == j) continue;
dis[i][j] = diss(a[i].first, a[i].second, a[j].first, a[j].second);
}
}
for(int i = 1; i <= n; i++)
mi_dis[i] = min(min(abs(a[i].first - x),abs(a[i].first - xx)), min(abs(a[i].second - y), abs(a[i].second - yy)));
dfs(0, 0, 0);
cout << round(ans);
return 0;
}