算法竞赛入门经典(训练指南)----图论算法与模型
wang2147483647
这个作者很懒,什么都没留下…
展开
-
LA 4255(p309)----Guess
#include #define debu using namespace std; const int INF=99999; struct point { int x,y; point(int a=0,int b=0):x(a),y(b) {} }; const int maxn=15; char st[60]; stack s; int d[maxn]; int n,sum[m原创 2016-03-05 19:44:09 · 290 阅读 · 0 评论 -
LA 4287(p322)----Proving Equivalences
#include #define debu using namespace std; const int maxn=1e5+50; int s[maxn]; int v[maxn]; int dfn[maxn]; int scc[maxn]; int low[maxn]; int sum1,sum2; int n,m,all,top,num; int din[maxn],dout[maxn]; v原创 2016-03-06 15:03:53 · 255 阅读 · 0 评论 -
LA 3211(p325)----Now or later
#include #define debu using namespace std; const int maxn=2*1e3+50; struct TwoSAT { int n; vector G[maxn*2]; bool mark[maxn*2]; int S[maxn*2],c; bool dfs(int x) { if(ma原创 2016-03-06 17:14:06 · 322 阅读 · 0 评论 -
UVA 11090(p333)----Going in Cycle!!
#include #define debu using namespace std; const int maxn=100; struct Edge { int from,to; double dist; }; struct BellmanFord { int n,m; vector edges; vector G[maxn]; bool inq[m原创 2016-03-06 22:10:17 · 301 阅读 · 0 评论 -
UVA 11374(p329)----Airport Express
#include #define debu using namespace std; const int INF=999999; const int maxn=1e4+50; struct Edge { int from,to,dist; Edge(int a=0,int b=0,int c=0):from(a),to(b),dist(c) {} }; struct HeapNod原创 2016-03-07 11:38:44 · 353 阅读 · 0 评论 -
UVA 10917(p330)----Walk through the Forest
#include #define debu using namespace std; const int INF=1e10; const int maxn=1e3+50; struct Edge { int from,to,dist; Edge(int a=0,int b=0,int c=0):from(a),to(b),dist(c) {} }; struct HeapNode原创 2016-03-10 22:09:24 · 274 阅读 · 0 评论