求最大费用能够将边权取负以转化成求最小费用. 然而此时依旧不正确.由于会优先寻找最大流.可是答案并不一定出如今满流的时候.所以要加一些边(下图中的红边)使其在答案出现时满流. 设全部边的流量为1,花费例如以下图所看到的. 显然最大花费是1001.而没有红边的情况下会得到3. #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <c…
Special Fish Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2367    Accepted Submission(s): 878 Problem Description There is a kind of special fish in the East Lake where is closed to campus o…
Special Fish Problem Description There is a kind of special fish in the East Lake where is closed to campus of Wuhan University. It's hard to say which gender of those fish are, because every fish believes itself as a male, and it may attack one of s…
题目要的并不是最大匹配下得到的最大的结果. 网上流行的做法是加边.其实,在连续增广的时候求得一个可行流的总费用为负就停止这样就行了. #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; #define INF (1<<30) #define MAXN 222 #define MAXM 22222 struct Edg…
Matrix Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2350    Accepted Submission(s): 1241 Problem Description Yifenfei very like play a number game in the n*n Matrix. A positive integer number…
void addedge(int fr,int to,int cap,int cos){ sid[cnt].fr=fr;sid[cnt].des=to;sid[cnt].cap=cap;sid[cnt].cos=cos;sid[cnt].next=nd[fr];nd[fr]=cnt++; sid[cnt].fr=to;sid[cnt].des=fr;sid[cnt].cap=;sid[cnt].cos=-cos;sid[cnt].next=nd[to];nd[to]=cnt++; } int s…
Description At the end of the 200013 th year of the Galaxy era, the war between Carbon-based lives and Silicon civilization finally comes to its end with the Civil Union born from the ruins. The shadow fades away, and the new-born Union is opening a…
Cyclic Tour Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/65535 K (Java/Others) Total Submission(s): 1879    Accepted Submission(s): 938 Problem Description There are N cities in our country, and M one-way roads connecting them. Now L…
题意 在一个有向图当中,现在每一条边带有一个容量,现在有K个人在起点,需要到终点去吃饭,询问这K个人最后一个人到达食堂的最小时间是多少 贴一篇题解:http://blog.csdn.net/u013761036/article/details/38268335 代码 #include <bits/stdc++.h> #define MAXN 5005 #define MAXM 100010 #define inf 0x7f7f7f7f using namespace std; struct E…
Special Fish Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2189    Accepted Submission(s): 826 Problem Description There is a kind of special fish in the East Lake where is closed to campus of…