Talent Contest
Limits: 2 sec., 256 MiB
Marichka is preparing a dance for a talent contest which is one of the “Miss Hight School” rounds. In order to prepare she needs a lot of space thus she has decided to set up a dancing floor in her cellar.
The cellar is a N meters by N meters square room divided by 1x1 square cells. Each cell is either empty or contains a sack of potatoes. The dancing floor should be a square with all empty cells and sides parallel to the cellar walls. Zenyk is ready to help Marichka with moving sacks of potatoes out of the cellar but since he is extreamly busy he can move up to K sacks.
Help Marichka and Zenyk to find the largest square they can use as a dancing floor.
Input
The first line contains two integers N and K separated by a single space. Each of the following N lines contains a string of N characters. Each character is either ‘0’ (denotes an empty cell) or ‘1’ (denotes a cell with a sack of potatoes).
Output
The maximal possible square side length that can be used as a dancing floor.
Constraints
\(1 \le \mathbf{N} \le 10\),
\(0 \le \mathbf{K} \le 10\).
Samples
Input (stdin) | Output (stdout) |
---|---|
4 1 1011 0000 0010 1000 | 3 |
Submit a solution
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|
Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
---|