RoAlgo Contest #5 - Back to School Edition | suporter

This was the problem page during the contest. Access the current page here.
Time limit: 0.5s Memory limit: 128MB Input: Output:

XB has decided to become a football fan and started watching Liga 1. To enjoy as many successes as possible, he created his own championship with nn teams and mm stages, knowing for each team ii how many points they get in each stage jj, denoted as scorijscor_{ij}.

However, XB is a result-oriented supporter, and although loyalty should mean more in football, he cannot conceive staying with the same team even during tough times, so he can change his favorite team at most kk times during a season (he understands loyalty somewhat, just not entirely).

Task

The goal is to enjoy as many points as possible from his favorite teams throughout the season, knowing that he can change his favorite team at most kk times. If in a stage jj he supports team ii, the score he enjoys will increase by scorijscor_{ij}. Determine this maximum score.

Input Data

On the first line, there are three natural numbers, nn, mm, and kk, representing the number of teams, the number of stages, and the maximum number of favorite team changes.

On the next nn lines, there are mm natural numbers, scorijscor_{ij} representing the score obtained by team ii in stage jj.

Output Data

On the first line, there will be a single number, the maximum score XB can achieve if he supports the right teams.

Constraints and Clarifications

  • 1n,m,k3001 \leq n, m, k \leq 300
  • 0scorij50 \leq scor_{ij} \leq 5
# Points Constraints
0 0 Example
1 9 k=0k = 0
2 14 k1k \leq 1
3 44 n,m,k100n, m, k \leq 100
4 33 No further constraints

Example

stdin

4 5 1
3 2 4 5 1
1 1 5 5 5
2 4 1 2 3
4 5 2 1 3

stdout

24

Explanation

XB can first support team 44 for two rounds, and then he will support team 22, thus obtaining 4+5+5+5+5=244 + 5 + 5 + 5 + 5 = 24 points.

Log in or sign up to be able to send submissions!