自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 收藏
  • 关注

原创 hdu 1754 I Hate It 线段树

#include #include #define N 200200int max[4*N];int n,m;int A,B;int L,R;int MAX(int a,int b){ if(a>b) return a; else return b;}int MIN(int a,int b){ if(a<b) return a; else return b;}v

2013-12-23 00:24:32 487

原创 hdu 4292 Food 最大流

将人拆点,之间连接一条容量为1的边,表示一个人只能选一次,从s到每种食物连接一条容量为该种食物总数的边,从每种饮料连接一条容量为该种饮料总量的边,如果一个人喜欢某种食物或饮料,连边即可。#include #include #include using namespace std;const int maxn=1200;const int inf=1000000;int n,f,d;

2013-12-22 21:23:54 470

原创 hdu 2222 Keywords Search AC自动机

AC自动机的裸题,不过需要注意几个地方,keywords中有重复的,而且模板中会重复出现keywords~#include #include #define SIGMA_SIZE 26#define MAXNODE 500100using namespace std;int ch[MAXNODE][SIGMA_SIZE];int f[MAXNODE]; // fail函数

2013-12-21 11:50:35 466

原创 hdu 3572 Task Schedule hdu 2883 kebab 最大流

注意一个地方,在建立好层次图进行dfs增广时,如果某个点增广不出流量,那么将该点level值置为0,即将它在该层次图中删除,剪枝,否则会超时~#include #include #include using namespace std;const int maxn=1050;#define inf 10000000int n,m;int level[maxn],que[maxn*

2013-12-20 16:18:32 587

原创 poj 1966 Cable TV Network 点连通度

#include #include #define Max 300#define INF 5000000int flow[Max][Max],d[Max];int map[Max][Max];int sta,end; int m,n;int min(int a,int b){ if(a<b) return a; else return b;}bool bfs(

2013-12-17 20:38:56 695

原创 hdu 2236 匹配

#include #include #define maxn 110int nx,ny;int map[maxn][maxn],ans,sx[maxn],sy[maxn];int cx[maxn],cy[maxn];int down;int l,r,mid;int path(int u){ sx[u]=1; int v; for(v=1;v<=ny;v++

2013-12-15 13:16:21 541

原创 zoj 2429 Destroying The Graph 最小点权覆盖

#include #include #include using namespace std;#define Max 230#define INF 100000000int flow[Max][Max],d[Max];int vis[Max*3];int sta,end; vector sum;int min(int a,int b){ if(a<b) return

2013-12-12 17:12:35 680

原创 poj 3469 Dual Core CPU 最小割

#include #include #include using namespace std;const int maxn=20000+50,inf=100000000;int n,m;int level[maxn],que[maxn*10];int head[maxn*3],lon;int min(int a,int b){ if(a<b) return a; else r

2013-12-12 17:00:09 512

原创 hdu 4496 D-City 并查集

#include #include #define maxn 10050int n,m;int p[maxn],x[maxn*10],y[maxn*10];int find(int x){ if(p[x]==x) return x; else return p[x]=find(p[x]);}int link(int u,int v){ int x,y; x=find(u)

2013-12-10 23:25:28 446

转载 Kosaraju算法的分析和证明 转自http://blog.sina.com.cn/s/blog_4dff87120100r58c.html

Kosaraju算法是求解有向图强连通分量(strong connected component)的三个著名算法之一,能在线性时间求解出一个图的强分量。用Sedgewick爷爷的话说,就是“现代算法设计的胜利”。什么是强连通分量?在这之前先定义一个强连通性(strong connectivity)的概念:有向图中,如果一个顶点s到t有一条路径,t到s也有一条路径,即s与t互相可达,那么我们说s

2013-12-09 11:27:45 902

原创 hdu 2767 Proving Equivalences 强连通

#include#include#include#include#includeusing namespace std;const int maxn = 20000 + 10;vector G[maxn], G2[maxn];vector S;int vis[maxn], sccno[maxn], scc_cnt;void dfs1(int u) { if(vi

2013-12-08 15:23:46 576

原创 hdu 4587 TWO NODES 关节点

#include #include #include using namespace std;#define maxn 5020vector g[maxn];int pre[maxn],low[maxn],iscut[maxn];int n,m;int dfs_clock;int del;int min(int a,int b){ if(a<b) return a;

2013-12-08 15:21:39 625

原创 hdu 3635 Dragon Balls 并查集

#include #include #define maxn 10200int p[maxn],tran[maxn],cap[maxn];int t;int find(int x){ int a; if(p[x]==x) return x; else { a=find(p[x]); tran[x]+=tran[p[x]]; p[x]=a; return p[

2013-12-08 15:20:07 538

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除