Skip to content

Commit 4abd25e

Browse files
author
hangyeol
committed
92차 2번 문제풀이
1 parent f02248b commit 4abd25e

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

live9/test92/문제2/백한결.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
def solution(board, skill):
2+
count = 0
3+
4+
diff = [[0] * (len(board[0])+1) for _ in range(len(board) + 1)]
5+
6+
for type, r1, c1, r2, c2, degree in skill:
7+
if type == 1:
8+
degree = -degree
9+
10+
diff[r1][c1] += degree
11+
diff[r1][c2+1] -= degree
12+
diff[r2+1][c1] -= degree
13+
diff[r2+1][c2+1] += degree
14+
15+
for i in range(len(board)):
16+
for j in range(len(board[0])):
17+
diff[i][j+1] += diff[i][j]
18+
19+
for i in range(len(board)):
20+
for j in range(len(board[0])):
21+
diff[i+1][j] += diff[i][j]
22+
23+
for i in range(len(board)):
24+
for j in range(len(board[0])):
25+
board[i][j] += diff[i][j]
26+
if board[i][j] > 0:
27+
count +=1
28+
29+
return count

0 commit comments

Comments
 (0)