P28968 [洛谷] [BJOI2019] Deployment of Soldiers
提高-
题目描述

Problem Description

Little C is playing a game of deploying soldiers. In the game, there are $n$ castles, and each round of the game involves two players competing for these castles. Each player has $m$ soldiers, which can be deployed to the $i$-th castle with $a_i$ soldiers to compete for that castle, ensuring the total number of soldiers does not exceed $m$.

If a player deploys more than twice the number of soldiers than the opponent to the $i$-th castle, that player captures the castle and earns $i$ points.

Now, Little C is about to face off against $s$ other players in one-on-one matches, and the deployment strategy must be the same for all $s$ matches. Little C has obtained information about the strategies the other $s$ players will use, and he wants to know what strategy he should use to maximize his total score.

Since the answer may not be unique, you only need to output the maximum total score Little C can achieve.

Input Format

The first line of input contains three positive integers $s, n, m$, representing the number of players other than Little C, the number of castles, and the number of soldiers each player has, respectively.

The next $s$ lines, each containing $n$ non-negative integers, represent the strategy of a player, where the $i$-th number $a_i$ indicates the number of soldiers this player deploys to the $i$-th castle.

Output Format

Output a single non-negative integer, representing the maximum score Little C can achieve.

Sample Input and Output

Input Sample #1

1 3 10
2 2 6

Output Sample #1

3

Input Sample #2

2 3 10
2 2 6
0 0 0

Output Sample #2

8

Notes/Hints

Sample 1 Explanation:
Little C's best strategy is to deploy 5 soldiers to both the 1st and 2nd castles.

Sample 2 Explanation:
One of Little C's best strategies is to deploy 2 soldiers to the 1st castle, 5 soldiers to the 2nd castle, and 1 soldier to the 3rd castle.

Data Range:
For $10\%$ of the data: $s=1, n \le 3, m \le 10$
For $20\%$ of the data: $s=1, n \le 10, m \le 100$
For $40\%$ of the data: $n \le 10, m \le 100$
For another $20\%$ of the data: $s=1$
For $100\%$ of the data:
$1 \le s \le 100$
$1 \le n \le 100$
$1 \le m \le 20000$
For each player, $a_i \ge 0$, $\sum_{i=1}^n a_i \le m$

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 3 10 2 2 6
样例输出
3