Theme:
N-node, M-Bar-free graph. Each node has a weighted value of W. Defines the cost of removing a node as the sum of the weights of the nodes adjacent to it. After removing a node, delete all the edges connected to the node. The minimum cost of removing all nodes. Input Description: Input includes multiple test data. The first line of test data in each group is first entered N,m (1?≤?n?≤?10000; 0?≤?m?≤?20000). The second line enters N integer wi (0?≤?wi?≤?105), followed by M-line. two integers per line U. V for node U is connected to V (1?≤?ui,?vi?≤?n; ui?≠?vi). Output Description: For each set of test data. The minimum cost of the output to remove all nodes.
Idea: Just read the question, thought the problem is more difficult, and then think about not know how to do, and then consulted others, did not think the idea will be so simple.
We get a weight for each side of the line. according to the node weights from large to small delete. This allows the weight and the minimum of all sides, that is, the minimum cost to think about the amount.
Code: Slightly .....
Happy Summer Vacation The first question of the online programming contest: Split point game