点在同一个SCC中即可。*/
#include//G++ 343ms,/c++,898ms 不知道为神马。。。求解释。。#include #include #include #include #include using namespace std;int n;const int MAX=201;struct points //点,01,23,45.。。相连为一对,x^1取对应点(改变奇偶性){ int x,y;};points point[MAX];int low[MAX];int dfn[MAX];int visited[MAX];bool is_instack[MAX];stack s;int times=0; int scc[MAX]; int numblock;vector >edges(MAX); //原图void initialize() //初始化要注意!看哪里新建图,新遍历了。因为它耽误了好久!{ numblock=times=0; for(int i=0;i<2*n;i++) { visited[i]=low[i]=dfn[i]=is_instack[i]=0; edges[i].clear(); scc[i]=-1; }}void tarjan(int u) //有向图dfs,这个不解释{ low[u]=dfn[u]=++times; is_instack[u]=1; s.push(u); int len=edges[u].size(); for(int i=0;i low[v])low[u]=low[v]; } else if(is_instack[v]&&dfn[v] >1)!=(j>>1))&&dis(point[i],point[j])<4*r*r) //这里的读入很妙(学来的),等价偶数枚举其大2之后的,奇数枚举其后(比他大1)所有 { edges[i].push_back(j^1); edges[j].push_back(i^1); } } for(int i=0;i<2*n;i++) { if(visited[i]==0) { visited[i]=1; tarjan(i); } } for(int i=0;i<2*n;i+=2) { if(scc[i]==scc[i+1]) //矛盾的点在一个SCC中, { return false; } } return true;}void readin(){ for(int i=0;i 0.0001) //二分答案! { mid=(right+left)/2; if(check(mid)) { left=mid; } else { right=mid; } } printf("%.2f\n",left); }}