Test instructions: A company has n can build a communication war place, the construction cost is PI, then the first company will choose to use the communication station AI and BI, the use of the cost is CI, and then ask the communication company how to build station can make the most profit. (Net Profit = Total income-Total cost);
Online to see a puzzle, directly said it is a minimum cut, the minimum cut and then the total profit-the smallest cut just. This kind of solving is a little use and no, why is the smallest cut, have to explain it, put down conclusion ran, this kind of solving the purpose of writing.
After checking a national training team's paper "Minimum cut model in the application of the informatics competition" only to understand that the largest right to the smallest cut, and why can turn into the smallest cut, to see the proof of the paper.
It has been pointed out in the paper that the so-called closed graph is the successor of the point in the closed graph. The closed graph is the relationship between the necessary conditions of things, that is, a point is the necessary conditions for its successor (do not know the necessary conditions of their own Baidu), that is, to have this point, its successor must also exist. Then back to the question, if a company wants to use a communication station, then it is necessary to build a station AI and bi, then this is a requirement, that is, the company can be with the station AI and bi two have a forward edge, and then the company this point of power is CI, two station point of the right is-PI, it is clear that The maximum right-of-view is the maximum net yield we are looking for.
Then the maximum weight = positive point right and-minimum cut. The least-cut method is, establish a source point s,s and a positive weight point, edge right is the weight of the point, set up a meeting point t,t and negative weight points, edge right is the absolute value of the point, the other side is infinite (take a INF on the line), and then set template Dinic,sap all line, to find a minimum cut is good. Or that sentence, why this conversion to see the paper, I only carry the practice.
Actually is a template problem, the code will not write.
Copyright NOTICE: This article is the original blogger article, reproduced please indicate the source Http://blog.csdn.net/hitwhacmer1
NOI 2006 maximum profit maximum weight closed graph turn min cut to maximum flow