Misolovke
There are mice in Mirko's basement! As soon as he realised, he filled his basement with mousetraps. His basement can be modelled by an N×N grid. There are a number of mousetraps in each cell and this number is known for each cell. There is at least one mousetrap in every cell. Improbably, Slavko also just discovered mice in his basement! However, Slavko has no mousetraps so he came to borrow some from Mirko. Because Mirko already laid out his mousetraps in his basement they needed to figure out what to do. They decided to remove some mousetraps from Mirko's basement. More precisely, in each row they will remove all mousetraps from exactly K consecutive cells. After doing this the mice must not be able to cross from the left to the right side of the basement, or from top to bottom. Mice move in the four cardinal directions (up, down, left and right) and can pass only through cells with no mousetraps
in them. Calculate the largest number of mousetraps that can be removed from Mirko's basement.
4 2
5 5 1 1
1 5 5 1
1 1 5 5
5 5 1 1Output:
36 Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.