Submission #7597045


Source Code Expand

Copy
h,w = map(int,input().split())
grid = [[c=="."for c in input()]for _ in range(h)]
L,R,U,D = eval("[[0]*(w+2) for _ in range(h+2)],"*4)
for y in range(h):
	for x in range(w):
		if grid[y][x]:
			L[y+1][x+1] = L[y+1][x]+1
		if grid[y][w-x-1]:
			R[y+1][w-x] = R[y+1][w-x+1]+1
for x in range(w):
	for y in range(h):
		if grid[y][x]:
			U[y+1][x+1] = U[y][x+1]+1
		if grid[h-y-1][x]:
			D[h-y][x+1] = D[h-y+1][x+1]+1
a = 0
for y in range(1,h+1):
	for x in range(1,w+1):
		a = max(a, L[y][x] + R[y][x] + U[y][x] + D[y][x] -3)
print(a)

Submission Info

Submission Time
Task D - Lamp
User KouCuriosity
Language PyPy3 (2.4.0)
Score 400
Code Size 548 Byte
Status
Exec Time 1127 ms
Memory 197384 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 01.txt, 02.txt
All 400 / 400 01.txt, 02.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt
Case Name Status Exec Time Memory
01.txt 162 ms 38384 KB
02.txt 160 ms 38256 KB
11.txt 1030 ms 197384 KB
12.txt 796 ms 195464 KB
13.txt 1077 ms 195720 KB
14.txt 1061 ms 195592 KB
15.txt 957 ms 190300 KB
16.txt 1045 ms 195080 KB
17.txt 1127 ms 195848 KB
18.txt 1103 ms 195976 KB
19.txt 938 ms 182748 KB
20.txt 188 ms 40944 KB
21.txt 162 ms 38256 KB
22.txt 190 ms 41584 KB
23.txt 766 ms 194952 KB
24.txt 178 ms 40176 KB
25.txt 243 ms 44652 KB