Problem: 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.

Submission attempts (in order):
import numpy as np
h, w = list(map(int, input().split()))
ss = np.array([list(input()) for _ in range(h)])
print(ss)

ans = 0
ws = np.zeros((h, w))
hs = np.zeros((h, w))

i = 0
while i < h:
	j = 0
	while j < w:
		if ss[i, j] == ".":
			end = w
			for k in range(j, w):
				if ss[i, k] == "#":
					end = k
			ws[i, j:end] = end - j
			j = end + 1
		else:
			j += 1
	i += 1

j = 0
while j < w:
	i = 0
	while i < h:
		if ss[i, j] == ".":
			end = h
			for k in range(i, h):
				if ss[k, j] == "#":
					end = k
			hs[i:end, j] = end - i
			i = end + 1
		else:
			i += 1
	j += 1

#print(ws)
#print(hs)
print(int(np.amax(ws + hs) - 1))

import numpy as np

h, w = list(map(int, input().split()))
d = {".":0, "#":1}
ss = np.array([list(input()) for _ in range(h)])
ss = np.array([[d[x] for x in s] for s in ss])

ans = 0
ls = np.zeros((h, w))
rs = np.zeros((h, w))
us = np.zeros((h, w))
ds = np.zeros((h, w))

for i in range(h):
	if ss[i, 0] == 0:
		ls[i, 0] = 1
	for j in range(1, w):
		if ss[i, j] == 0:
			ls[i, j] = ls[i, j - 1] + 1		

	if ss[i, w - 1] == 0:
		rs[i, w - 1] = 1
	for j in reversed(range(w - 1)):
		print(j)
		if ss[i, j] == 0:
			rs[i, j] = rs[i, j + 1] + 1

for j in range(w):
	if ss[0, j] == 0:
		us[0, j] = 1
	for i in range(1, h):
		if ss[i, j] == 0:
			us[i, j] = us[i - 1, j] + 1

	if ss[h - 1, j] == 0:
		ds[h - 1, j] = 1
	for i in reversed(range(h - 1)):
		if ss[i, j] == 0:
			ds[i, j] = ds[i + 1, j] + 1

# print(ss)
# print(ls)
# print(rs)
# print(us)
# print(ds)

print(max(int(np.amax(ls + rs + us + ds) - 3), 0))


import numpy as np

h, w = list(map(int, input().split()))
d = {".":1, "#":0}
ss = np.array([list(input()) for _ in range(h)])
ss = np.array([[d[x] for x in s] for s in ss])

ls, rs, us, ds = [np.ones((h, w)) for _ in range(4)]

for i in range(1, w):
	ls[:, i] = ss[:, i] * (ls[:, i - 1] + 1)

for i in reversed(range(w - 1)):
	rs[:, i] = ss[:, i] * (rs[:, i + 1] + 1)

for i in range(1, h):
	us[i, :] = ss[i, :] * (us[i - 1, :] + 1)

for i in reversed(range(h - 1)):
	ds[i, :] = ss[i, :] * (ds[i + 1, :] + 1)

print(max(int(np.amax(ls + rs + us + ds) - 3), 0))


import numpy as np

h, w = list(map(int, input().split()))
d = {".":1, "#":0}
ss = np.array([list(input()) for _ in range(h)]) == "."
ss_t = ss.transpose()

ls, rs, us, ds = [np.zeros((h, w), dtype=int) for _ in range(4)]

ls, rs = ls.transpose(), rs.transpose()

ls[0] = ss_t[0]
rs[w-1] = ss_t[w-1]
us[0] = ss[0]
ds[h-1] = ss[h-1]

for i in range(1, w):
	ls[i] = ss_t[i] * (ls[i - 1] + 1)

for i in reversed(range(w - 1)):
	rs[i] = ss_t[i] * (rs[i + 1] + 1)

for i in range(1, h):
	us[i] = ss[i] * (us[i - 1] + 1)

for i in reversed(range(h - 1)):
	ds[i] = ss[i] * (ds[i + 1] + 1)

# print(ss)
# print(ls)
# print(rs)
# print(us)
# print(ds)
print(max(np.amax((ls.transpose() + rs.transpose() + us + ds) - 3), 0))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted