Contest Duration: - (local time) (100 minutes) Back to Home

Submission #5884497

Source Code Expand

Copy
```import numpy as np
import sys
buf = sys.stdin.buffer

# 周りに壁を、0,1化、壁を0で持つ
grid = np.zeros((H+2,W+2),dtype=np.bool)

# x軸方向の集計
def F(transpose):
x = grid
if transpose:
x = (x.T).copy()
x = np.ravel(x) # to 1D array
L = len(x)

left_zero = -np.arange(L) # 左の壁のindexの-1倍
left_zero[x] = 0
np.minimum.accumulate(left_zero, out=left_zero)

right_zero = np.arange(L) # 逆順ソートした上で左の壁のindex
right_zero[x[::-1]] = 0
np.maximum.accumulate(right_zero, out=right_zero)

y = left_zero
y += L-right_zero[::-1]

return y.reshape(grid.T.shape).T if transpose else y.reshape(grid.shape)

```

#### Submission Info

Submission Time 2019-06-12 12:21:37+0900 D - Lamp maspy Python (3.4.3) 400 894 Byte AC 435 ms 145468 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
 AC × 2
 AC × 17
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 148 ms 12480 KB
02.txt AC 148 ms 12192 KB
11.txt AC 389 ms 145288 KB
12.txt AC 380 ms 145468 KB
13.txt AC 427 ms 144908 KB
14.txt AC 420 ms 145452 KB
15.txt AC 356 ms 137984 KB
16.txt AC 381 ms 145196 KB
17.txt AC 427 ms 145436 KB
18.txt AC 435 ms 145288 KB
19.txt AC 363 ms 130512 KB
20.txt AC 148 ms 12740 KB
21.txt AC 148 ms 12188 KB
22.txt AC 150 ms 13704 KB
23.txt AC 355 ms 145444 KB
24.txt AC 148 ms 12584 KB
25.txt AC 148 ms 12592 KB