A group of K
The movie theater has R
The extension is defined as the area of the smallest rectangle with sides parallel to the seats that contains all bought seats. The area of a rectangle is the number of seats contained in it. They've taken out a laptop and pointed at you to help them find those desired seats.
Each test case will consist on several lines. The first line will contain three positive integers R
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/839-2.png"
ALT="$ \le$">R
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/839-2.png"
ALT="$ \le$">300
$1 \le K \le R \times C$
-->
1
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/839-2.png"
ALT="$ \le$">K
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/839-2.png"
ALT="$ \le$">R×C
<TT>X</TT>' if the <SPAN CLASS="MATH"><I>j</I></SPAN>
.' if it is available. There will always be at least K
<tex2html_verbatim_mark>-th seat on the <SPAN CLASS="MATH"><I>i</I></SPAN>
<tex2html_verbatim_mark>-th row is taken or
Input is terminated with <!-- MATH
$R = C = K = 0$
-->
R = C = K = 0
For each test case, output a single line containing the minimum extension the group can have.
3 5 5
...XX
.X.XX
XX...
5 6 6
..X.X.
.XXX..
.XX.X.
.XXX.X
.XX.XX
0 0 0
6
9
Migrated from old NTUJ.
South America 2007
No. | Testdata Range | Score |
---|