2014年2月26日

URAL 1742 Team building 强联通

摘要: 每个人到他认为最强的人连一条边。缩点后,入度为0的点是最小解,强联通分量是最大解。---const int maxn=111100;const int maxm=210000;int n;struct Node { int to,next;} edges[maxm];int head[maxn],edge;void addedge(int u,int v) { edges[edge].to=v,edges[edge].next=head[u],head[u]=edge++;}void prepare() { memset(head,-1,sizeof head); ed... 阅读全文

posted @ 2014-02-26 11:13 电子幼体 阅读(142) 评论(0) 推荐(0) 编辑

ZOJ 3156 Taxi 二分二分图

摘要: ----------const int maxn=411;const int maxm=141011;int n,m;double x[maxn],y[maxn];double a[maxn][maxn];double disTo(int i,int j) { return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));}double dis[maxn*maxn];int cnt;double T;VI g[maxn];int from[maxn],tot;bool use[maxn];bool match(int u) { ... 阅读全文

posted @ 2014-02-26 11:10 电子幼体 阅读(125) 评论(0) 推荐(0) 编辑

导航