Question: Input: The input consists of two lines. The first line contains two space - separated integers, m and n , the number of rows and

Input:
The input consists of two lines. The first line contains two space-separated integers, m and n, the number of rows and columns in the grid, respectively. The second line contains m strings, each of length n, representing the grid. Each character in the grid is either a ' : '(representing good land) or an 'x'(representing a hole).
Output:
The output consists of a single integer, the perimeter of the largest possible rectangular area that does not contain any holes. If such an area cannot be constructed, output the string "impossible".
Constraints:
1m,n200
samples:
Sample Input:
45
....
.x.x.
.....
.....
Sample Output:
14
q,
Sample Input:
22
.x
x.
Sample Output:
Imp
Example 2:
45
\table[[.,.,.,.,.],[.,x,.,x,.],[.,x,.,.,.],[.,.,.,.,.]]
In this example we can build only 7 possible paling does not contain any holes
P=10
\table[[.,*,.,.,*ossibleqquadImportant note: the execution time shouldn't exceed 2 seconds and any test case that exceeds the limit will be considered a timeout.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!