UVALive - 3487 Duopoly (minimum cut)

Meaning of the questions: There are two companies A and B in the application of some resources, given the content of the two companies now are applying, including resource prices and applications, and now you, as an official, you can only refuse a request or accept a request , the same can not be two companies have the resources, and the application of resources not just to some, Q: as an official, you can get the maximum benefit is how much.

Analysis: The title of this contradiction that can not share the same resources of both companies, being the case, then it would find application conflicts, so even the lines between them can be a capacity of INF, set up source, source a company's application and connected capacity to apply the price, the establishment of Meeting point Meeting point B and connected to the company's application, the capacity of the price of the application, and then find contradictory application connection. Because only contradictory application in order to connect, and only connection to the stream flow to the sink, it ran out of the maximum flow minimum cut is what we need, so the answer is the sum of the price of all applications - minimum cut, remove the smallest after the cut, there is no relationship between the two set points, there would be a contradiction. Construction Plan is as follows.

to sum up:

Code: to be completed, the reference https://blog.csdn.net/L123012013048/article/details/48133037 .

Guess you like

Origin blog.csdn.net/tianwei0822/article/details/92796304