-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0428.py
More file actions
29 lines (23 loc) · 801 Bytes
/
0428.py
File metadata and controls
29 lines (23 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def solution(arr,H):
K = len(arr)
N = len(arr) / H
M = len(arr[0])
dx = [-1,+1,0,0,0,0]
dy = [0,0,-1,+1,0,0]
dz = [0,0,0,0,-H,+H]
while:
for i in range(K):
for k in range(M):
if arr[i][k] == 0:
continue
elif arr[i][k] == -1:
continue
else:
for j in range(6):
if k + dx[j] >= 0 and k + dx[j] <= M:
answer = arr[i][k+dx[j]] + 1
if answer == 0:
continue
else:
arr[i][k+dx[j]] = 1
if i + dy[j] >=0 and i + dy[j] <= H: