自定义博客皮肤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 1814 2-SAT

#include #include #include #include #include using namespace std;const int maxn = 2E4 + 10;int n, m, first[maxn], Next[maxn * 2], vis[maxn], S[maxn], tol, cnt, a, b;struct Edge{ int u, v; E

2016-04-30 21:09:25 448

原创 POJ 3469 最小割

#include #include #include #include #include #include using namespace std;const int INF = 0x3f3f3f3f;const int MAX_N = 2E4 + 10;const int MAX_M = 2E5 + 10;int N, M, A[MAX_N], B[MAX_N], b[MAX

2016-04-29 17:08:33 317

原创 ZOJ 3195 LCA

#include #include #include #include #include #include using namespace std;const int maxn = 2E5 + 10;int n, m, x, y, z, kase;struct Node{ int to, val; Node(int to = 0, int val = 0): to(to),

2016-04-29 15:10:57 260

原创 POJ 3680 最小费用最大流

题意:给定n个带权开区间,选择其中一些使得权值最大并且区间重叠层数不超过k。题解:最小费用流,区间有两百个,可以用左边的点发出一条到右边的点的边,容量为1,费用为负的权值。然后从左往右将依次将相邻的两个点都连起来,权值为0,容量为k,也就是说,如果选了这个区间,就会从费用为负数的边流过去,否则,就是从这个费用为0的边流过去。然后建立一个虚拟源点与最左边的点相连,权值为0,容量为k,这样

2016-04-27 22:28:25 537

原创 POJ 3422 最小费用流

#include #include #include #include #include using namespace std;const int maxn = 1E5 + 10;const int maxm = 1E6 + 10;const int INF = 0x3f3f3f3f;struct Edge{ int to, next, cap, flow, cost

2016-04-27 21:07:44 334

转载 Edmonds_Karp 算法

有n个点,有m条有向边,有一个点很特殊,只出不进,叫做源点,通常规定为1号点。另一个点也很特殊,只进不出,叫做汇点,通常规定为n号点。每条有向边上有两个量,容量和流量,从i到j的容量通常用c[I,j]表示,流量则通常是f[I,j]。通常可以把这些边想象成道路,流量就是这条道路的车流量,容量就是道路可承受的最大的车流量。很显然的,流量       把源点比作工厂的话,问题就是求从工厂最大可以

2016-04-26 16:23:31 465

原创 POJ 1459 最大流

#include #include #include #include using namespace std;const int maxn = 110;const int INF = 0x3f3f3f3f;int mp[maxn][maxn], path[maxn], flow[maxn], Start, End, n, nc, np, m, u, v, z;queueq;in

2016-04-26 16:21:52 457

原创 HDU 2874 LCA

#include #include #include #include using namespace std;const int maxn = 1E5 + 10;const int maxm = maxn * 2;const int maxq = 2E6 + 10;int n, m, q, dis[maxn], vis[maxn], father[maxn], ans[maxq

2016-04-26 14:10:35 359

原创 HDU 4183 网络流

#include#include#include#include#include#define debuusing namespace std;const int maxn = 5000+10;const int INF = 1000000000;struct Edge{ int from, to, cap, flow; Edge(int a,int b,int

2016-04-24 20:31:03 422

原创 HDU 4248 DP与组合数学

#include #include const int maxn = 110;const int mod = 1E9 + 7;int c[maxn * maxn][maxn], num[maxn];long long dp[maxn][maxn * maxn];int n, kase;void init(){ for (int i = 0; i < maxn * maxn; i+

2016-04-16 22:01:20 368

原创 HDU 4269 数位dp

#include #include #include using namespace std;typedef long long LL;const int maxn = 15;LL dp[maxn][2];int a[maxn], b[maxn], c[maxn], lena, lenb, lenc, kase;char s[50];void init(){ memset(d

2016-04-16 21:22:16 469

原创 POJ 3544

#include const int INF = 0x7f7f7f7f;using namespace std;int flow[205][205], cap[205][205], p[205], c[205]; // f用来记录单前节点流,p用来记录父路径void BFS( int&maxflow, int N ){ queueq; maxflow = 0;

2016-04-01 18:44:53 481

原创 POJ 3744 概率dp

#include #include #include #include using namespace std;struct Matrix{ double mat[2][2];};Matrix mul(Matrix a, Matrix b){ Matrix ret; for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j

2016-04-01 16:20:34 473

空空如也

空空如也

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

TA关注的人

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