Submission #21974702
Source Code Expand
H,W = map(int,input().split())
MAP = []
for i in range(H):
MAP.append(list(input()))
U = [[0] * W for i in range(H)]
D = [[0] * W for i in range(H)]
L = [[0] * W for i in range(H)]
R = [[0] * W for i in range(H)]
for i in reversed(range(H)):
for j in range(W):
if MAP[i][j]=='.' and i<H-1:
U[i][j] = U[i+1][j]+1
elif MAP[i][j]=='.':
U[i][j] = 1
for i in range(H):
for j in range(W):
if MAP[i][j]=='.' and i>0:
D[i][j] = D[i-1][j]+1
elif MAP[i][j]=='.':
D[i][j] = 1
for i in range(H):
for j in reversed(range(W)):
if MAP[i][j]=='.' and j<W-1:
L[i][j] = L[i][j+1]+1
elif MAP[i][j]=='.':
L[i][j] = 1
for i in range(H):
for j in range(W):
if MAP[i][j]=='.' and j>0:
R[i][j] = R[i][j-1]+1
elif MAP[i][j]=='.':
R[i][j] = 1
ans = 0
for i in range(H):
for j in range(W):
ans = max(ans,U[i][j]+D[i][j]+L[i][j]+R[i][j]-3)
print(ans)
Submission Info
| Submission Time | |
|---|---|
| Task | D - Lamp |
| User | H20 |
| Language | PyPy3 (7.3.0) |
| Score | 400 |
| Code Size | 1064 Byte |
| Status | AC |
| Exec Time | 818 ms |
| Memory | 353760 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 01.txt, 02.txt |
| All | 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 | AC | 87 ms | 61960 KiB |
| 02.txt | AC | 53 ms | 62332 KiB |
| 11.txt | AC | 730 ms | 353384 KiB |
| 12.txt | AC | 698 ms | 352964 KiB |
| 13.txt | AC | 793 ms | 352720 KiB |
| 14.txt | AC | 761 ms | 353712 KiB |
| 15.txt | AC | 703 ms | 337752 KiB |
| 16.txt | AC | 732 ms | 352636 KiB |
| 17.txt | AC | 818 ms | 353752 KiB |
| 18.txt | AC | 813 ms | 353760 KiB |
| 19.txt | AC | 664 ms | 321872 KiB |
| 20.txt | AC | 73 ms | 68224 KiB |
| 21.txt | AC | 51 ms | 62076 KiB |
| 22.txt | AC | 78 ms | 69168 KiB |
| 23.txt | AC | 654 ms | 353492 KiB |
| 24.txt | AC | 69 ms | 68340 KiB |
| 25.txt | AC | 103 ms | 70936 KiB |