摘要: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<vector> using namespace std; // push_back inline in 阅读全文
posted @ 2019-06-01 23:15 starve_to_death 阅读(151) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2342 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<vector> using namesp 阅读全文
posted @ 2019-06-01 22:35 starve_to_death 阅读(114) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2019-06-01 22:08 starve_to_death 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 割点: void tarjan(int u){ dfn[u]=low[u]=++cnt; int flag=0; for(int i=head[u];~i;i=e[i].nextt){ int v=e[i].v; if(!dfn[v]){ tarjan(v); low[u]=min(low[u],l 阅读全文
posted @ 2019-05-31 17:34 starve_to_death 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 建超级s向每个食物连容量为1的边,超级汇点t; 每个饮料向t连容量为1的边,将每头牛拆点,一个连该牛喜欢的食物,另一点连该牛喜欢的饮料,俩个点相连,容量均为1; ans=跑一遍最大流 #include<iostream> #include<cstring> #include<cstdio> #inc 阅读全文
posted @ 2019-05-30 23:19 starve_to_death 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 学习资料:https://www.cnblogs.com/shadowland/p/5872257.html 板子: void tarjan(int u){ dfn[u]=low[u]=++cnt; sta[++top]=u; vis[u]=true; for(int i=0;i<g[u].size 阅读全文
posted @ 2019-05-29 20:56 starve_to_death 阅读(162) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> #include<queue> using namespace std; typedef long long ll; inline int read() 阅读全文
posted @ 2019-05-28 23:30 starve_to_death 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 把该图的无向边随便定向,计算每个点的入度和出度。如果有某个点出入度之差为奇数,那么肯定不存在欧拉回路。因为欧拉回路要求每点入度 = 出度,也就是总度数为偶数,存在奇数度点必不能有欧拉回路; 好了,现在每个点入度和出度之差均为偶数。那么将这个偶数除以2,得x。也就是说,对于每一个点,只要将x条边改变方 阅读全文
posted @ 2019-05-28 18:51 starve_to_death 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1,从各个顾客到汇点各有一条边,容量就是各个顾客能买的数量上限。 2,在某一轮中,从该顾客打开的所有猪圈都有一条边连向该顾客,容量都是∞。 3,最后一轮除外,从每一轮的i号猪圈都有一条边连向下一轮的i号猪圈,容量都是∞,表示这一轮剩下的猪可以留到下一轮。 4,最后一轮除外,从每一轮被打开的所有猪圈, 阅读全文
posted @ 2019-05-28 00:03 starve_to_death 阅读(110) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3507 解释:当且仅当g【j,k】程璐,j对dp【i】的更新由于k对dp【i】的; 解释:对于第2点,因为单调队列维护的要是斜率上升的数据结构;所以要做此循环 对于第3点,因为是斜率上升的数据结构,所以如果满足持续 阅读全文
posted @ 2019-05-22 23:50 starve_to_death 阅读(126) 评论(0) 推荐(0) 编辑