Created
May 12, 2017 20:10
-
-
Save peroon/0af60a49d4fab15a89013e240f032466 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
import os | |
def print2d(M): | |
print() | |
for row in M: | |
print(row) | |
for s in sys.stdin: | |
H, W = map(int, s.split()) | |
if H == W == 0: | |
break | |
M = [] | |
for i in range(H): | |
M.append(input().strip()) | |
#print2d(M) | |
# make support map (H x W) | |
S = [[0 for i in range(W)] for j in range(H)] | |
for y in range(H-1, -1, -1): | |
cnt = 0 | |
for x in range(W-1, -1, -1): | |
if M[y][x] == '.': | |
cnt += 1 | |
else: | |
cnt = 0 | |
S[y][x] = cnt | |
#print2d(S) | |
max_area = 0 | |
for y in range(H): | |
for x in range(W): | |
if M[y][x] == '.': | |
y_offset = 0 | |
min_width = S[y][x] | |
while y + y_offset < H and M[y + y_offset][x] == '.': | |
if S[y + y_offset][x] < min_width: | |
min_width = S[y + y_offset][x] | |
area = min_width * (y_offset + 1) | |
if area > max_area: | |
max_area = area | |
y_offset += 1 | |
print(max_area) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment