HDU 3468 Treasure Hunting
类似二分图。匹配之类的。。
//author: CHC//First Edit Time: 2014-08-16 18:54//Last Edit Time: 2014-08-16 19:20#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;typedef long long LL;const int MAXN=1e+5;const int MAXM=1e+6;const int INF = INT_MAX;struct Edge{ int from,to,ci,next; Edg ...
HDU 3416 Marriage Match IV
先从源点跑最短路。
如果某条边是最短路上的边。那么建图的时候就把它加进去。
//author: CHC//First Edit Time: 2014-08-15 11:43//Last Edit Time: 2014-08-15 12:46#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;typedef long long LL;const int MAXN=1e+4;const int MAXM=1e+6;const int INF=INT_MAX;struct Edge{ int f ...
HDU 3277 Marriage Match III
二分答案跑最大流。。
//author: CHC//First Edit Time: 2014-08-11 16:00//Last Edit Time: 2014-08-11 16:49#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;typedef long long LL;const int MAXN=1e+3;const int MAXM=1e+5;const int INF = INT_MAX;//const int LL_INF = INT64_MAX;struct Edge{ ...
HDU 3081 Marriage Match II
。。暴力枚举答案跑最大流。。
可以二分枚举的。。
//author: CHC//First Edit Time: 2014-08-11 13:55//Last Edit Time: 2014-08-11 15:39#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;typedef long long LL;const int MAXN=1e+3;const int MAXM=1e+5;const int INF = INT_MAX;struct Edge{ int from,to,ci,n ...
HDU 3605 Escape
//author: CHC//First Edit Time: 2014-08-10 15:08//Last Edit Time: 2014-08-10 15:26#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;typedef long long LL;const int MAXN=1e+4;const int MAXM=1e+5;const int INF = INT_MAX;//const LL LL_INF = LONG_LONG_MAX;struct Edge{ int fro ...
HDU 4240 Route Redundancy
模板题。
只需要在找路径减去流量的过程中找到那个最大的就行了。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;#define MAXN 1500#define MAXM 600000const int INF = INT_MAX;typedef long long LL;struct Edge{ int from,to,ci,next; Edge(){} Edge(int _from,int _to,int _ci,int _next):from(_f ...
HDU 2883 kebab
关键是缩点。
//author: CHC//First Edit Time: 2014-08-10 09:35//Last Edit Time: 2014-08-10 14:58#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;typedef long long LL;const int MAXN=1e+4;const int MAXM=1e+6;//const int INF = INT_MAX;//const LL LL_INF = LONG_LONG_MAX;struct Edge{ ...
HDU 4183 Pahom on Water
建图方式:
我的方式为:先看从s到t的方法种数和t到s的方法种数,如果都大于1的话就是合法的。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;#define MAXN 1500#define MAXM 600000const int INF = INT_MAX;typedef long long LL;struct Edge{ int from,to,ci,next; Edge(){} Edge(int _from,int _to,int _ci,in ...
HDU 3572 Task Schedule
。。。建图。判满流。
建图方式:
源点到机器连边。容量为最大值。
机器到第i天连边,容量为1
第i天到事件连边,容量为1
所有事件到汇点连边。容量为所需时间。
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;#define MAXN 1500#define MAXM 600000const int INF = INT_MAX;typedef long long LL;struct Edge{ int from,to,ci,next; Edge(){} E ...
HDU 3549 Flow Problem
模板题。
//author: CHC//First Edit Time: 2014-08-03 14:21//Last Edit Time: 2014-08-03 14:21#include <iostream>#include <cstdio>#include <cstring>#include <cmath>#include <set>#include <vector>#include <map>#include <queue>#include <set>#include <algorithm>#include <limits.h>using namespace std;#define MAXN 10000#define MAXM 100000const int INF = INT_MAX;typedef long long LL;struct Edge{ int from,to,ci,next; Edge(){ ...