Welcome to The Rice Fields!

First of all, welcome, to The Rice Fields!

The Rice Fields is, in fact, ​an enormous realm with both explored and unexplored areas. Until now, every square meter of it is either water (marked with 0) or plants (marked with 1).

Now, some citizen of The Rice Fields would like to know the area of the biggest possible square house that can be built in it. A square house must be built on plant area and each of its 4 walls must be parallel to either the \(x\)-axis or the \(y\)-axis.

The Rice Fields is described in this file: RiceFields.txt. The first two numbers at the top represent the number of rows and columns, in that order. The rest of the file is a matrix of zeros and ones.

Example: Consider the following 4 x 4 field

\[ \begin{array} { l l l l }
0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 \\ 1 & 0 & 0 & 0 \\ \end{array} \]

Two most optimal solutions, area in both cases is 4

Two most optimal solutions, area in both cases is 4

×

Problem Loading...

Note Loading...

Set Loading...