感受
思路
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e3 + 10;
struct node{
ll dis;
int u, v;
bool operator < (const node& b)const{
return dis < b.dis;
}
}e[maxn * maxn];
bitset<maxn> bit[maxn], tmp;
pair<ll, ll> p[maxn];
int n, cnt;
ll get(int u, int v){
return (p[u].first - p[v].first) * (p[u].first - p[v].first) + (p[u].second - p[v].second) * (p[u].second - p[v].second);
}
void init(){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
if(i != j) bit[i].set(j, true);
}
}
}
int main(){
scanf("%d", &n);
for(int i = 1; i <= n; i++){
scanf("%lld%lld", &p[i].first, &p[i].second);
}
for(int i = 1; i <= n; i++){
for(int j = i + 1; j <= n; j++){
e[++cnt] = (node){get(i, j), i, j};
}
}
init();
sort(e + 1, e + cnt + 1);
int u, v; ll ans = 0;
for(int i = 1; i <= cnt; i++){
u = e[i].u, v = e[i].v;
tmp = bit[u] & bit[v];
if(tmp.any()) ans = e[i].dis;
bit[u].set(v, false);
bit[v].set(u, false);
}
printf("%.20f\n", sqrt(ans) / 2.0);
return 0;
}



京公网安备 11010502036488号