刚学了Dinic就开始做题,然后就崩了. 题意:若干个任务,可以放在两个CPU中任意一个上完成,各有一定代价.其中又有若干对任务,如果它们不在同一个CPU上完成,会产生额外代价.最小化并输出代价. 一开始的想法是吧一个任务拆开成两个点(受2-sat的影响),然后就发现自己没法做了.首先,需要保证由同一个任务拆成的两个点只流过一个,这就会使最大流变成费用流.(我不会费用流)其次,难以满足第二个要求.后来一想,网络流与2-sat建图的区别在于网络流的状态表现在边的流量上(是否满流),而2-sat表现…
Dual Core CPU Time Limit: 15000MS   Memory Limit: 131072K Total Submissions: 25576   Accepted: 11033 Case Time Limit: 5000MS Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft C…
题目:http://poj.org/problem?id=3469 最小割水题(竟然没能1A): 代码如下: #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; ,maxm=2e5+,inf=0x3f3f3f3f; ,cur[maxn],ans; queue<int>q; struct N{ int to,nxt,w;…
形象生动的最小割.. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; #define INF (1<<30) #define MAXN 2222 #define MAXM 888888 struct Edge{ int v,cap,flow,next; }edge[MAXM]; int vs,vt,NE,NV;…
题意:给你n个模块,每个模块在A核花费为ai,在B核跑花费为bi,然后由m个任务(ai,bi,wi),表示如果ai,bi不在同一个核上跑,额外的花费为wi,求最小的花费. 一开始想的时候以为是费用流,但想着想着觉得,这么大的数据量绝对不可能是费用流.最后发现它是一个最小割模型.实际上就是要将网络里的模块划分成s-t两个点集,然后我们合适的构造一下边就可以使得对应的最小割就是我们的答案,构造的方法是这样的:当模块属于A集的时候,花费为ai,所以就从向t连一条ai的边,而当模块属于B集的时候,花费为…
Dual Core CPU Time Limit: 15000MS   Memory Limit: 131072K Total Submissions: 24830   Accepted: 10756 Case Time Limit: 5000MS Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft C…
Dual Core CPU Time Limit: 15000MS Memory Limit: 131072K Total Submissions: 20935 Accepted: 9054 Case Time Limit: 5000MS Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corpor…
Dual Core CPU Time Limit: 15000MS   Memory Limit: 131072K Total Submissions: 21453   Accepted: 9297 Case Time Limit: 5000MS Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Co…
Time Limit: 15000MS   Memory Limit: 131072K Total Submissions: 23780   Accepted: 10338 Case Time Limit: 5000MS Description As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corporation, de…
Drainage Ditches 自己拉的专题里面没有这题,网上找博客学习网络流的时候看到闯亮学长的博客然后看到这个网络流入门题!随手一敲WA了几发看讨论区才发现坑点! 本题采用的是Edmonds-Karp算法求增广路.小白书上只介绍了这个算法,确实对于数据不刁钻的题目这个算法足以应对.大白书上的Dinic及SAP.ISAP还没有去看,以后慢慢攻克吧! 回到这个题:n条水渠,m个交点,每条水渠有一个最大容量cap,求1号交点到m号交点的最大流. 学了EK算法这题就可以裸引用了,只是注意一个坑点:…