CF1082C Multi-Subject Competition
题目描述
现在有 $n$ 个人分成 $m$ 组,第 $i$ 个人属于第 $s_i$ 组,能力值为 $r_i$ 。 现在你要选择任意一些组,在这些组中选择相同数目的人,最大化他们的能力值总和。
输入格式
无
输出格式
无
说明/提示
In the first example it's optimal to choose candidates $ 1 $ , $ 2 $ , $ 3 $ , $ 4 $ , so two of them specialize in the $ 2 $ -nd subject and other two in the $ 3 $ -rd. The total sum is $ 6 + 6 + 5 + 5 = 22 $ .
In the second example it's optimal to choose candidates $ 1 $ , $ 2 $ and $ 5 $ . One person in each subject and the total sum is $ 6 + 6 + 11 = 23 $ .
In the third example it's impossible to obtain a non-negative sum.