摘要: 匈牙利 cpp include include include using namespace std; int n, m, lst[105], uu, vv, cnt, ans; bool edge[105][105], vis[105]; bool dfs(int x){ for(int i=m 阅读全文
posted @ 2017-12-25 19:25 poorpool 阅读(109) 评论(0) 推荐(0) 编辑
摘要: ss是源点,代表餐巾卖家,tt是汇点,代表记账收钱者。 记p(i)是i天早晨的可用毛巾数,q(i)是i天完了的废毛巾数。 建图见注释 cpp include include include include using namespace std; typedef long long ll; int 阅读全文
posted @ 2017-12-25 18:41 poorpool 阅读(103) 评论(0) 推荐(0) 编辑
摘要: luogu 匈牙利算法 cpp include include include using namespace std; int n, m, uu, vv, e, lnk[1005], ans; bool a[1005][1005], vis[1005]; bool dfs(int u){ for( 阅读全文
posted @ 2017-12-21 21:01 poorpool 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 每次选代价最小的流增广 cpp include include include include using namespace std; struct Edge{ int too, nxt, val, cst; }edge[100005]; int n, m, ss, tt, maxFlow, mi 阅读全文
posted @ 2017-12-21 19:39 poorpool 阅读(108) 评论(3) 推荐(0) 编辑
摘要: 当前弧优化 cpp include include include include using namespace std; int n, m, ss, tt, hea[10005], cnt, uu, vv, ww, maxFlow, cur[10005]; int lev[10005]; con 阅读全文
posted @ 2017-12-20 19:26 poorpool 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 练一下最大流 cpp include include include include using namespace std; int n, m, ron[205][205], pre[205], uu, vv, ww, vis[205]; queue d; int ek(){ int maxFlo 阅读全文
posted @ 2017-12-20 11:09 poorpool 阅读(128) 评论(3) 推荐(0) 编辑
摘要: dp[i]表示第一队打饭时间i的最优解 cpp include include include include using namespace std; struct Node{ int aa, bb; }nd[205]; int n, sum[205], dp[40005], ans=0x3f3f 阅读全文
posted @ 2017-12-20 09:39 poorpool 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 就是一步一步把大的往目标地放。 cpp include include using namespace std; int fro[55], too[55], cnt, uu, n, ans=0; void dfs(int x, int qu){ if(fro[x]==qu) return ; for 阅读全文
posted @ 2017-12-19 21:39 poorpool 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 搜索+背包就是了 cpp include include include using namespace std; int n, m, a[25], ans=0, lst=0; bool isu[25], f[2005]; void dfs(int x){ if(x==m+1){ int cnt=0 阅读全文
posted @ 2017-12-19 20:43 poorpool 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 点 $ (i,j) $ 会看不见当有 $ k|i $ 且 $ k|j$ 时。 然后就成了求欧拉函数了。 cpp include include include using namespace std; int n, phi[40005], pri[40005], cnt; bool isp[4000 阅读全文
posted @ 2017-12-19 20:08 poorpool 阅读(137) 评论(0) 推荐(0) 编辑