Diamond咋都是模板题... 开个坑刷codevs的Master题.巩固一下姿势. 目前AC的题目:1001,1021,1022, 1001.舒适的路线(并查集) 求出无向图s到t路径上的min(最大边权/最小边权).(n<=500,m<=5000) 边权排序一下,枚举最小边,将比它大的边权依次加入并查集直到s和t联通,此时的最大边权一定最小.复杂度O(m^2). # include <cstdio> # include <cstring> # include &l…
Dilworth定理,将最长反链转化为最小链覆盖.//貌似还能把最长上升子序列转化为不上升子序列的个数? floyd传递闭包,将可以重叠的最小链覆盖转化成不可重叠的最小路径覆盖.(引用:这样其实就是相当于将原图改造了一下,只要 x 能到达 y ,就直接连一条边 (x, y),这样就可以“绕过”原图的一些被其他路径占用的点,直接构造新路径了.) 建立二分图,跑匈牙利.(见白书P357) #include<cstdio> #include<cstring> using namespac…
Antenna Placement Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6991 Accepted: 3466 Description The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most st…
[题意] 给定有向图 G=(V,E).设 P 是 G 的一个简单路(顶点不相交) 的集合.如果 V 中每个顶点恰好在 P 的一条路上,则称 P 是 G 的一个路径覆盖. P 中路径可以从 V 的任何一个顶点开始, 长度也是任意的, 特别地, 可以为 0. G 的最小路径覆盖是 G 的所含路径条数最少的路径覆盖.设计一个有效算法求一个有向无环图 G 的最小路径覆盖. 输入文件示例 input.txt11 121 21 31 42 53 64 75 86 97 108 119 1110 11输出文件…
经典二分图匹配问题.把每个点拆成两个,对于原图中的每一条边(i,j)连接(i,j+n),最小路径覆盖就是点数n-二分图最大匹配.方案直接顺着匹配dsf.. #include<iostream> #include<cstdio> using namespace std; const int N=505,M=120005; int n,m,h[N],cnt,lk[N],t,v[N],ans; struct qwe { int ne,to; }e[M]; int read() { int…
Taxi Cab Scheme Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 231 Accepted Submission(s): 142 Problem Description Running a taxi station is not all that simple. Apart from the obvious deman…
Strategic Game Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following problem. He must defend a medieval city, the roads of which form a t…
Antenna Placement Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7788 Accepted: 3880 Description The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most st…
Antenna Placement Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7329 Accepted: 3635 Description The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most st…