题意:
就是给出n对坐标,每对只能选一个,以选出来的点为圆心,半径自定义,画圆,而这些圆不能覆盖,求半径最小的圆的最大值
解析:
看到最x值最x化,那二分变为判定性问题,然后。。。然后我就没想到。。。
好的吧。。。2-sat 还能在不是一对的两个值之间建边。。。求出连通分量后 看一对中的两个坐标是否在一个连通分量中
在一个说明半径太小 要加大 反之。。反之。
因为涉及小数 要用eps
#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <cctype>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#define eps 1e-8
#define rap(i, a, n) for(int i=a; i<=n; i++)
#define rep(i, a, n) for(int i=a; i<n; i++)
#define lap(i, a, n) for(int i=n; i>=a; i--)
#define lep(i, a, n) for(int i=n; i>a; i--)
#define rd(a) scanf("%d", &a)
#define rlld(a) scanf("%lld", &a)
#define rc(a) scanf("%c", &a)
#define rs(a) scanf("%s", a)
#define pd(a) printf("%d\n", a);
#define plld(a) printf("%lld\n", a);
#define pc(a) printf("%c\n", a);
#define ps(a) printf("%s\n", a);
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = 1e5 + , INF = 0x7fffffff, LL_INF = 0x7fffffffffffffff;
int n;
vector<int> G[maxn];
int vis[maxn], low[maxn], scc_clock, scc_cnt, sccno[maxn];
stack<int> S; struct node
{
int x, y;
}Node[maxn]; void dfs(int u)
{
vis[u] = low[u] = ++scc_clock;
S.push(u);
for(int i = ; i < G[u].size(); i++)
{
int v = G[u][i];
if(!vis[v])
{
dfs(v);
low[u] = min(low[u], low[v]);
}
else if(!sccno[v])
{
low[u] = min(low[u], vis[v]);
}
}
if(low[u] == vis[u])
{
scc_cnt++;
for(;;)
{
int x = S.top(); S.pop();
sccno[x] = scc_cnt;
if(x == u) break;
}
}
} double dis(node a, node b)
{
return sqrt((double)(a.x - b.x) * (a.x - b.x) + (double)(a.y - b.y) * (a.y - b.y));
} void build(double mid)
{
for(int i = ; i < maxn; i++) G[i].clear();
for(int i = ; i < n * ; i++)
for(int j = ; j < n * ; j++)
if(i / != j / && dis(Node[i], Node[j]) < mid)
{
G[i].push_back(j ^ ); G[j].push_back(i ^ );
}
} void init()
{
mem(vis, );
mem(low, );
mem(sccno, );
scc_cnt = scc_clock = ;
} bool check()
{
for(int i = ; i < n * ; i += )
{
if(sccno[i] == sccno[i ^ ])
return false;
}
return true;
} int main()
{
while(cin >> n)
{
for(int i = ; i < n; i++)
{
cin >> Node[i << ].x >> Node[i << ].y >> Node[(i << ) + ].x >> Node[(i << ) + ].y;
}
double l = , r = INF;
while(r - l > eps)
{
init();
double mid = l + (r - l) /(double) ;
build(mid * );
for(int i = ; i < n * ; i++)
if(!vis[i]) dfs(i);
if(check()) l = mid;
else r = mid;
}
printf("%.2f\n", l);
} return ;
}