Problem:


Score : 400 points

Problem Statement

There is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.

Snuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.
The lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.
In each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.

Snuke wants to maximize the number of squares lighted by the lamp.

You are given H strings S_i (1 \leq i \leq H), each of length W. If the j-th character (1 \leq j \leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.

Find the maximum possible number of squares lighted by the lamp.

Constraints

1 \leq H \leq 2,000

1 \leq W \leq 2,000

S_i is a string of length W consisting of # and ..

. occurs at least once in one of the strings S_i (1 \leq i \leq H).

Input

Input is given from Standard Input in the following format:

H W
S_1
:
S_H

Output

Print the maximum possible number of squares lighted by the lamp.

Sample Input 1

4 6
#..#..
.....#
....#.
#.#...

Sample Output 1

8

If Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.

Sample Input 2

8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#

Sample Output 2

13



Sample input:
4 6
#..#..
.....#
....#.
#.#...


Sample output:
8

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
buf = sys.stdin.buffer
 
H, W = map(int, buf.readline().split())
grid = np.zeros((H + 2, W + 2), np.int32)
grid[1:-1, 1:-1] = np.where(np.array(list(map(list, buf.read().decode('utf-8').split()))).reshape(H, W) == '.', 1, 0)
grid_v = grid.T
 
right = np.maximum.accumulate(np.where(grid < 1, np.arange(W + 2), 0), axis=1)
down = np.maximum.accumulate(np.where(grid_v < 1, np.arange(H + 2), 0), axis=1).T
 
print(np.max(right + down) - 3)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
buf = sys.stdin.buffer

H, W = map(int, buf.readline().split())
#print(read[1].decode('utf-8'))
grid = np.zeros((H + 2, W + 2), dtype='int32')
#grid[1:-1, 1:] = \
temp = list(map(list, buf.read().decode('utf-8').split()))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
S=[]
ans=0

for _ in range(H):
    S.append(list(input()))

l=[[0]*W for _ in range(H)]

for h in range(H):
    count=0
    start=0
    for index,item in enumerate(S[h]):
        if item=="#":
            for i in range(start,index):
                l[h][i]=count
            count=0
            start=index+1
        else:
            count+=1
    for i in range(start,W):
        l[h][i]=count

for w in range(W):
    count=0
    start=0
    for i in range(H):
        if l[i][w]=="#":
            for j in range(start,i):
                l[j][w]+=count
                ans=max(ans,l[i][w])
            count=0
            start=i+1
        else:
            count+=1
    for i in range(start,H):
        l[i][w]+=count
        ans=max(ans,l[i][w])
    
print(ans-1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
H,W=map(int,input().split())
S=[]
ans=0

for _ in range(H):
    S.append(list(input()))

l=[[0]*W for _ in range(H)]

for h in range(H):
    count=0
    start=0
    for index,item in enumerate(S[h]):
        if item=="#":
            for i in range(start,index):
                l[h][i]=count
            count=0
            start=index+1
        else:
            count+=1
    for i in range(start,W):
        l[h][i]=count

for w in range(W):
    count=0
    start=0
    for i in range(H):
        if l[i][w]=="#":
            for j in range(start,i):
                l[j][w]+=count
            count=0
            start=i+1
        else:
            count+=1
    for i in range(start,H):
        l[i][w]+=count
        ans=max(ans,l[i][w])
    

print(ans-1)

Submission status: Wrong Answer

Solution code:
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LIS(): return list(map(str,sys.stdin.readline().split()))
ans = int(1)
ansC = int(0)

H, W = LI()
S = [str(input()) for _ in range(H)]
dpW = [[0]*W for _ in range(H)]
dpH = [[0]*W for _ in range(H)]

Submission status: Wrong Answer

Solution code:
#%%
import numpy as np

h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())
s_0 = np.array(s)
s_90 = np.rot90(s_0)
s_180 = np.rot90(s_90)
s_270 = np.rot90(s_180)

c_0 = np.zeros(h*w).reshape(h,-1)
c_0[s_0 == '.'] = 1
c_90 = np.zeros(h*w).reshape(w,-1)
c_90[s_90 == '.'] = 1
c_180 = np.zeros(h*w).reshape(h,-1)
c_180[s_180 == '.'] = 1
c_270 = np.zeros(h*w).reshape(w,-1)
c_270[s_270 == '.'] = 1

for i in range(h):
    for j in range(1, w):
        if c_0[i][j] >=  1:
            c_0[i][j] += c_0[i][j-1]
#print(c_0)

for i in range(w):
    for j in range(1, h):
        if c_90[i][j] >=  1:
            c_90[i][j] += c_90[i][j-1]
c_90 = np.rot90(np.rot90(c_90))
c_90 = np.rot90(np.rot90(np.rot90(c_90)))
#print(c_90)

for i in range(h):
    for j in range(1, w):
        if c_180[i][j] >=  1:
            c_180[i][j] += c_180[i][j-1]
c_180 = np.rot90(np.rot90(c_180))
#print(c_180)

for i in range(w):
    for j in range(1, h):
        if c_270[i][j] >=  1:
            c_270[i][j] += c_270[i][j-1]
c_270 = np.rot90(np.rot90(c_270))
c_270 = np.rot90(c_270)
#print(c_270)

c = c_0 + c_90 + c_180 + c_270 - 3
print(int(c.max()))

Submission status: Wrong Answer

Solution code:
H, W = map(int, input().split())

# 上下左右に余分に1マスとっとく
square = [[0 for _ in range(W)] for _ in range(H)]

for row in range(H):
	S = list(map(str, input()))
	for column in range(W):
		if S[column] == "#":
			# 下駄をはかせるの忘れない
			square[row][column] = -1
			
for row in range(H):
	done = [False for _ in range(W)]
	for column in range(W):
		if square[row][column] == -1: continue
		if done[column]: continue
		l = 1
		while column + l <= W - 1:
			if square[row][column + l] == -1: break
			l += 1
		for i in range(column, column + l):
			square[row][i] += l
			done[i] = True
			
for column in range(W):
	done = [False for _ in range(H)]
	for row in range(H):
		if square[row][column] == -1: continue
		if done[row]: continue
		l = 1
		while row + l <= H - 1:
			if square[row + 1][column] == -1: break
			l += 1
		for i in range(row, row + l):
			square[i][column] += l
			done[i] = True

ret = 0			
for row in range(H):
	for column in range(W):
		ret = max(ret, square[row][column] - 1)
		
		
print(ret)

Submission status: Wrong Answer

Solution code:
h, w = map(int, input().split())
s = [[] for _ in range(h)]
for i in range(h):
    s[i] = list(input())

hs = [[0]*w for _ in range(h)]
ws = [[0]*w for _ in range(h)]

for i in range(h):
    c = 0
    for j in range(w):
        if s[i][j] == '.':
            c += 1
            hs[i][j] = c
        else:
            c = 0
    for j in range(-1, -w-1, -1):
        if j != -1:
            if hs[i][j] != 0 and hs[i][j+1] != 0:
                hs[i][j] = hs[i][j+1]


print(hs)

Submission status: Wrong Answer

Solution code:
def main():
    H, W = map(int, input().split())
    S = list(list(input()) for _ in range(H))

    left = [[0] * W for _ in range(H)]
    right = [[0] * W for _ in range(H)]
    up = [[0] * W for _ in range(H)]
    down = [[0] * W for _ in range(H)]

    for i in range(H):
        cur = 0
        for j in range(W):
            if S[i][j] == '#':
                cur = 0
            else:
                cur += 1
            left[i][j] = cur

    for i in range(H):
        cur = 0
        for j in range(W-1,-1,-1):
            if S[i][j] == '#':
                  cur = 0
            else:
                cur += 1
            right[i][j] = cur

    for j in range(W):
        cur = 0
        for i in range(H):
            if up[i][j] == '#':
                cur = 0
            else:
                cur += 1
            up[i][j] = cur

    for j in range(W):
        cur = 0
        for i in range(H-1,-1,-1):
            if up[i][j] == '#':
                cur = 0
            else:
                cur += 1
            down[i][j] = cur

    ans = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                continue
            ans = max(ans, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3)

    print(ans)

main()

Submission status: Wrong Answer

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIACd4j10C/+19C3hTVbb/SdJHeDUB0VseSsEgRaS0UEqLoi0QOJEUKi2IjnhI05RW26STnEDxCbZVYqgyjtfxzp0H/5k7/udxr+Od/4yDjgMFlOIbURkeooyDemJFig+sOpC71t77pPucnFNg9Lvf9/++idKd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65XFabvjKjYR3t0qpC6L/sQuhtSmTO2ENBEi/MFpXogFvDF8ikd+GSdFIoC79omhdCcKBQFoBBrrOWRud3mOrS2CAK8v1jd70VnIj8067r9fQTRhdOm7QkgyuFNZzGdxSrTcMEE/1iGl3dKfbG7naOR3mLh3Xp18XCUkN0NOC8uhdwoZtDr0dG0J9i5ej6/0Wu4NYby3ay7310qVfi60XsTYS4SwidTN8WmWc03XR5eXcXcfpl1wbepG0G6/TE9HeCm6UCrYjsxSkFhAdxvnSrYF1zPOZ3m+vc73kSmitxv0G7vgb3P2ucweBUL3exFA8UndaqUj//o/dv67Lk/y8NM2szvn6c4OuehbfVRN9rTFzASZXyxvVMXc3vU4V5L1Bo0vl003pW7g83aCzNJCO9Xppzk9zYzk8Y1eHk8KVYFNoChh0ONzd8gajHno7vEEhwNYqJbC7W8GLwWTBwLxb1vXXfFFx+g3s+rFIY1Cgvu5/AFj8a6spjQAA'
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
input=sys.stdin.buffer
h,w=map(int,input().split())
s=[]
l=[[0 for i in range(w)]for j in range(h)]
 
for i in range(h):
    a=input()
    s.append(a)

yoko=[[0 for j in range(w)] for j in range(h)]
tate=[[0 for j in range(w)] for j in range(h)]

for i in range(h):
    p=0
    for j in range(w):
        if s[i][j]=="#" or j==w-1:
            if s[i][j]==".":
                for k in range(p):
                    yoko[i][j-k-1]+=p+1
                yoko[i][j]+=p+1
            else:
                for k in range(p):
                    yoko[i][j-k-1]+=p
            p=0
        elif s[i][j]==".":
            p+=1
for i in range(w):
    p=0
    for j in range(h):
        if s[j][i]=="#" or j==h-1:
            if s[j][i]==".":
                for k in range(p):
                    tate[j-k-1][i]+=p+1
                yoko[j][i]+=p+1
            else:
                for k in range(p):
                    tate[j-k-1][i]+=p
            p=0
        elif s[j][i]==".":
            p+=1
ans=0
for i in range(h):
    for j in range(w):
        ans=max(ans,yoko[i][j]+tate[i][j]-1)

print(ans)

'''