摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 int n, m; 9 int f[510]; 10 11 struct node 12 { 13 int... 阅读全文
posted @ 2017-08-06 18:32 ouyang_wsgwz 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 5 const int maxn = 10005; 6 int n, m; 7 int fa[28]; 8 struct node 9 { 10 int x, y; 11 int cost; 12 }arr[maxn]; 13 14 void init() 15 {... 阅读全文
posted @ 2017-08-06 17:05 ouyang_wsgwz 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1 //我看过Discuss说不能用克鲁斯卡尔因为有很多边 2 //但是只能用G++过,C++的确超时 3 #include 4 #include 5 #include 6 using namespace std; 7 8 struct node 9 { 10 int a, b, cost; 11 }c[30000]; 12 int fa[505];... 阅读全文
posted @ 2017-07-25 20:22 ouyang_wsgwz 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXN 10005 8 int fa[MAXN]; 9 struct node 10 { 11 int from, to, len; 12 }arr[MAXN]; 13 14 bool cmp(no... 阅读全文
posted @ 2017-07-25 09:59 ouyang_wsgwz 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 100005; 7 const int L = 100; 8 const int R = 100000; 9 int t, n, m, ans; 10 double total; 11 struct n... 阅读全文
posted @ 2017-07-25 09:26 ouyang_wsgwz 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #define N 110 5 #define M 5000 6 using namespace std; 7 8 int n, m, u[M], v[M], w[M], r[M], p[N]; 9 bool cmp(int i, int j){ return w[i]> m >> n&&m) 15 ... 阅读全文
posted @ 2017-07-23 19:49 ouyang_wsgwz 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1 //克鲁斯卡尔 2 #include 3 #include 4 using namespace std; 5 const int maxn = 10005; 6 struct node 7 { 8 int begin, end, len; 9 }cun[maxn]; 10 int n, fa[maxn], ans, m; 11 12 bool cmp(node a... 阅读全文
posted @ 2017-07-23 18:13 ouyang_wsgwz 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXN 1005 8 int n, m; 9 int fa[MAXN]; //父节点 10 int mark[MAXN]; 11 12 void init() 13 { 14 for (int ... 阅读全文
posted @ 2017-07-23 17:10 ouyang_wsgwz 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 int G[300][300]; 5 int Prev[300]; //路径上每个节点的前驱节点 6 bool Visited[300]; 7 int n,m; //m是顶点数目,顶点编号从1开始 1是源,m是汇, n是 边数 8 9 int Augment() 10 { ... 阅读全文
posted @ 2017-07-23 16:19 ouyang_wsgwz 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 啊呜啊呜,看来好几天的KM浸提终于弄懂了,前两天就一直看来着,然后看不明白,就放着了,今天不信,重拾KM终于磕会了。然后,其实好傻逼,就是匈牙利算法,加了一个+d -d的过程 首先来看一个例子(hdu 2255 奔小康赚大钱) 题意: 1.村委会有n个人,n个房子 2.每个人可以为多个房子出不同的价 阅读全文
posted @ 2017-07-22 16:32 ouyang_wsgwz 阅读(181) 评论(0) 推荐(0) 编辑