CF1846C Rudolf and the Another Competition
题目描述
Rudolf 已经报名了一个遵循 ICPC 规则的编程竞赛。这些规则意味着,每通过一道题,参与者将获得 $1$ 积分,同时还会受到相当于从比赛开始到 AC 时间的罚时。在排行榜中,分数高的参与者排名较高,如果分数相等,罚时较少的参与者排名较高。
现在总共有 $n$ 名参与者参与了比赛,Rudolf 是编号为 $1$ 的参与者。已知一共有 $m$ 题,$h$ 分钟。
现在,一个强大的人工智能已经预测到了值 $t_{i,j}$,它表示第 $i$ 位参与者解决第 $j$ 道问题所需的分钟数。
Rudolf 意识到解决问题的顺序可以影响最终的结果。例如,如果 $h = 120$,解决问题的时间是\[ $20,15,110$ \],那么,如果 Rudolf 按一下几种顺序解决问题,会出现一下几种情况:
- ${3,1,2}$,那么他只会解决第三个问题,得到 $1$ 积分和 $110$ 罚时。
- ${1,2,3}$,那么他将在开始的 $20$ 分钟后解决第一个问题,在 $20+15=35$ 分钟后解决第二个问题,他将没有时间解决第三个问题。因此,他将获得 $2$ 积分和 $20+35=55$ 罚时。
- ${2,1,3}$,那么他将在开始的 $15$ 分钟后解决第二个问题,在 $15+20=35$ 分钟后解决第一个问题,他将没有时间解决第三个问题。因此,他将获得 $2$ 点和 $15+35=50$ 的罚时。
Rudolf 感兴趣的是,如果每个参与者根据人工智能的预测,以最佳顺序解决问题,他将在比赛中为第几名。假设在积分和罚时相同的情况下,Rudolf 将占据最靠前的位置。
输入格式
无
输出格式
无
说明/提示
In the first example, Rudolf will get $ 2 $ points and $ 50 $ penalty minutes. The second participant will solve only one problem and get $ 1 $ point and $ 90 $ penalty minutes. And the third participant will solve all $ 3 $ problems and get $ 3 $ points and $ 240 $ penalty minutes. Thus, Rudolf will take the second place.
In the second example, both participants will get $ 1 $ point and $ 30 $ penalty minutes. In case of a tie in points, Rudolf gets the better position, so he will take the first place.
In the third example, Rudolf is the only participant, so he will take the first place.
In the fourth example, all participants can solve two problems with penalty of $ 25 = 8 + (8 + 9) $ , $ 24 = 7 + (7 + 10) $ and $ 26 = 8 + (8 + 10) $ , respectively, thanks to the penalty, the second participant gets the first place, and Rudolf gets the second.