๋ฌธ์
๋ฐฑ์ค ์จ๋ผ์ธ ์ ์ง - 17829๋ฒ
ํ์ด ๊ณผ์
๋ฅ๋ฌ๋์์ ์ฌ์ฉ๋๋ ํ๋ง
์ฐ์ฐ์ ๊ตฌํํ๋ ๋ฌธ์ ์
๋๋ค.
๋ฌธ์ ์์ ์ ์ํ ๊ฒ๊ณผ ๊ฐ์ด ๊ฐ ๋จ๊ณ์์ ๊ธธ์ด๊ฐ ๋ฐ์ฉ ์ค์ด๋ค๋๋ก ์ฐ์ฐ์ ๊ตฌํํ๋ฉด ๋ฉ๋๋ค.
์ฝ๋
import sys
import math
N = int(input())
matrix = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def pooling(matrix):
l = len(matrix)
k = l // 2
ret = [[0] * k for _ in range(k)]
nx = 0
for x in range(0, l, 2):
ny = 0
for y in range(0, l, 2):
window = [matrix[x][y], matrix[x + 1][y], matrix[x][y + 1], matrix[x + 1][y + 1]]
window.sort(reverse=True)
ret[nx][ny] = window[1]
ny += 1
nx += 1
return ret
def solution():
answer = matrix
for _ in range(int(math.log2(N))):
answer = pooling(answer)
return answer[0][0]
print(solution())
๋ฐ์ํ
'๐ algorithm > boj' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ 2529 - ๋ถ๋ฑํธ (0) | 2021.03.08 |
---|---|
BOJ 1802 - ์ข ์ด ์ ๊ธฐ (0) | 2021.03.08 |
BOJ 13905 - ์ธ๋ถ (0) | 2021.03.08 |
BOJ 2458 - ํค ์์ (0) | 2021.03.08 |
BOJ 18111 - ๋ง์ธํฌ๋ํํธ (0) | 2021.03.08 |
๐ฌ ๋๊ธ