"2018.10.12" Ghost Earth Chasing Soul

Source: Internet
Author: User

Original question

Title Description

One day Misaka and Kuroko are playing a game about ghost Earth chasing souls ....

Misaka and Kuroko play games on a $n * m$ board, with some gung-so on each grid. The game is a total of $k $ round, each round Kuroko will be chosen to have a row I, after which Misaka will choose a column $j $, and take the lattice $ (i, j) $ on all the quack too, Misaka want to take away the quack too much, And Kuroko didn't want to let Misaka take away a lot of quack too, so she wanted to take away the quack too as little as possible.

On the sidelines watching the constant temperature of the Grim Reaper hoping to predict the results, you can predict that the Misaka will eventually take away too much of it if both sides adopt an optimal strategy.

Enter a description

The first row three numbers $n, M, k$.
Next $n $ lines, each line $m $ number, and the number of $i $ line $j $ indicates that the chessboard $i $ line $j $ row on the number of _{i,j}$ $a.

Output Description

The output is a total of one number, which means that under your prediction, Misaka can finally take away the number of the quack.

Example 1input

3 2 4
5 7
3 2
8 5

Output

17

Notes

$1≤n, m≤1000, 1≤k≤n x m, 1≤a_{i,j}≤10^9$

Solving

To be reasonable, there are so many people in WA on the scene.

Read test instructions, the first can be seen to be a greedy.

Because the first choice of people to let the number of people to fetch as small as possible, it is easy to think of each take the remaining number of the smallest line of the maximum value.

But the direct turn to WA a wave, for a moment not figured out why wrong.

Later, a set of hack data was found:

2 3 3

50 50 50

100 2 1

According to the above-mentioned greedy practice, the result is 150, that is, the first election of people each time the first line.

But if three times Duchin the second line then the result is 103, but smaller.

Why is it? The second line has a 100 block, resulting in the number of the second row will not be taken, and the second row of the remaining two are very small, that is, the number of the front of the large can not determine the size of the subsequent number.

That is to say that the number of operations on this line has aftereffect, it can not be directly greedy.

Can that be DP? $k \le 1000000$, two-dimensional DP long ago the sky.

Tossing and turning seems to be greedy ...

That might have to be a bit of a conclusion.

In retrospect, since the yourselves election, the person chosen will certainly choose the largest number in this row,

So the number of rows per row is ordered, and each row must have been selected from the previous one.

Then for the above hack data, the introduction of a Do not know the right conclusion: when $k\ge m$, the number of rows to choose, it must be better than not to choose the end.

The intuitive feeling is that it solves the aftereffect of a line.

In this way, in order to make the number of candidates and as small as possible, the first choice of people must be based on each line and from small to general election.

"2018.10.12" Ghost Earth Chasing Soul

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.