CF1019A Elections

题目描述

Berland地区的腐败现象非常常见。 马上有一场选举,你事先知道了选民和政党的数量,分别为 $n$ 和 $m$ ,对于每一位选民,你知道他将要选举哪一个政党,不过,每一位选民都会在接受一定数额的金钱之后改变他的主意。如果你给第 $i$ 位选民 $c_i$ 数额的比特币,他就会选举任何你希望他选举的政党。 你的目的是让Berland的联合党赢得这场选举,联合党必须拥有比其它政党都多的选票,在此基础之上,你希望花费的比特币尽可能少。

输入格式

输出格式

说明/提示

In the first sample, The United Party wins the elections even without buying extra votes. In the second sample, The United Party can buy the votes of the first and the fourth voter. This way The Party gets two votes, while parties $ 3 $ , $ 4 $ and $ 5 $ get one vote and party number $ 2 $ gets no votes. In the third sample, The United Party can buy the votes of the first three voters and win, getting three votes against two votes of the fifth party.