QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#7891. 排兵布阵

統計

小 C 正在玩一款排兵布阵的游戏。在游戏中有 $n$ 座城堡,每局对战由两名玩家来争夺这些城堡。每名玩家有 $m$ 名士兵,可以向第 $i$ 座城堡派遣 $a_i$ 名士兵去争夺这个城堡,使得总士兵数不超过 $m$。

如果一名玩家向第 $i$ 座城堡派遣的士兵数严格大于对手派遣士兵数的两倍,那么这名玩家就占领了这座城堡,获得 $i$ 分。

现在小 C 即将和其他 $s$ 名玩家两两对战,这 $s$ 场对决的派遣士兵方案必须相同。小 C 通过某些途径得知了其他 $s$ 名玩家即将使用的策略,他想知道他应该使用什么策略来最大化自己的总分。

由于答案可能不唯一,你只需要输出小 C 总分的最大值。

输入格式

输入第一行包含三个正整数 $s,n,m$,分别表示除了小 C 以外的玩家人数、城堡数和每名玩家拥有的士兵数。

接下来 $s$ 行,每行 $n$ 个非负整数,表示一名玩家的策略,其中第 $i$ 个数 $a_i$ 表示这名玩家向第 $i$ 座城堡派遣的士兵数。

输出格式

输出一行一个非负整数,表示小 C 获得的最大得分。

样例数据

样例输入

1 3 10
2 2 6

样例输出

3

样例解释

小 C 的最佳策略为向第 $1$ 座城堡和第 $2$ 座城堡各派遣 $5$ 名士兵。

样例输入

2 3 10
2 2 6
0 0 0

样例输出

8

样例解释

小 C 的最佳策略之一为向第 $1$ 座城堡派遣 $2$ 名士兵,向第 $2$ 座城堡派遣 $5$ 名士兵,向第 $3$ 座城堡派遣 $1$ 名士兵。

子任务

对于 $10\%$ 的数据,保证 $s=1,n \le 3,m \le 10$。

对于 $20\%$ 的数据,保证 $s=1,n \le 10,m \le 100$。

对于 $40\%$ 的数据,保证 $n\le 10,m\le 100$。

对于另外 $20\%$ 的数据,保证 $s=1$。

对于 $100\%$ 的数据,保证

  • $1\le s \le 100$
  • $1\le n \le 100$
  • $1\le m \le 2\times 10^4$
  • 对于每名玩家,$a_i \ge 0, \sum\limits_{i=1}^n a_i \le m$。
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.