
图论
文章平均质量分 68
luyuncheng
luyuncheng@sina.com
展开
-
hdu2066spfa最短路+前向星 多源点多汇点
此题用纯暴力过了,但是我真没想到其他办法了!求大神指教#include #include #include #include using namespace std;#define MAXN 1001#define MAXM 10001#define INF 0x3f3f3f3fstruct Edge{ int v, w, next;} ed原创 2012-10-11 15:57:16 · 1696 阅读 · 0 评论 -
hdu2544spfa最短路+前向星(模板)
#include#include#define N 105#define M 10000#define oo 10000000struct node{ int to,next,cap;} edge[M*100];int mark[2*N],head[2*N],tot,src,cost[2*N];void add(int a,int b,int c){ edge[原创 2012-10-11 15:56:04 · 1003 阅读 · 0 评论 -
hdu2112map+spfa映射最短路
#include#include#include#includeusing namespace std;const int MAXE = 2*10005;const int MAXV = 205;//地名const int inf = 10000000;typedef struct node{ int s, t, w, next;} N;map station;N原创 2012-10-11 16:16:43 · 647 阅读 · 0 评论 -
SPOJ 4206 二分匹配HK算法
模板题 前向星建边的HK算法#include #include#include#include#includeusing namespace std;const int maxn=50100;const int maxm=151000;const int INF=0x3f3f3f3f;struct EDGE{ int b; int n原创 2012-11-23 02:33:06 · 1080 阅读 · 0 评论 -
cf 120 c,d,e STL Non-Secret Cypher Counter Attack
c题:建立一棵树,对于每个跟节点表示一个pair然后子节点是pair或者int叶子节点必然为int 加判断一下就好了D题:可以想对于一个右边已经定下的点,只要前面有个数大于k个那么就可以统计这个所有之前的位置都是满足条件的2 3 4 5 6 1 1 1.。。。。。假设k是3 那么在第三个1的位置可以匹配的个数就是2,3,4,5,6,1都可行。首先离散化一下值原创 2013-10-08 20:22:40 · 1163 阅读 · 0 评论 -
cf119 div1 a,b,c Permutations AlgoRace Weak Memory
a题:纸上模拟下就知道在b中找一个连续的序列对应a,那么其他后面的值都可以往后或者插入了。直接考虑b中连续的对应a的位置就好了b题:先预处理每辆车的floyd距离 然后dp【i】【j】【k】 用i辆车,从j到k的最短时间 转移是dp【i】【j】【k】=dp【i-1】【j】【kk】+dp【0】【kk】【k】 即类似floyd的转移c题:貌似很多人是二分+spfa或者原创 2013-10-09 12:10:14 · 1083 阅读 · 0 评论