White Rectangle

Problem #444

Tags: implementation c-1

Who solved this?

No translations... yet

This seems to be very old puzzle - Jacques Arsac mentions it in his book "Programming of games and puzzles" saying he encountered it "few years ago" at some programming contest, and the book was published in 1985 itself...

Given a matrix consisting of empty (white) cells and blocked (black) ones - we want to find largest "white" or empty rectangle.

Input and output format:

First line of input contains rows and columns - dimensions of the grid. Next rows lines will contain each a string of columns characters, either X or - (the former meaning blocked cell, the latter an empty one).

Answer should be a single value - area of the largest rectangle fitting into this grid.

Example:

input data:
7 9
-----X--X
--------X
---------
-----X---
--X---X--
---------
-----X---

answer:
20
You need to login to get test data and submit solution.