[TIL] Pintos - ๊ฐ์ ๋ฉ๋ชจ๋ฆฌ ๊ด๋ จ ๊ฐ๋
๊ณต๋ถ2
1. ์์นจ ๋ฌธ์ ํ์ด 1. 10026๋ฒ - ์ ๋ก์์ฝ import sys from collections import deque N = int(sys.stdin.readline()) pic = [list(sys.stdin.readline().strip()) for _ in range(N)] dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def bfs(x, y) : queue = deque() queue.append((x, y)) visited[x][y] = True while queue : cx, cy = queue.popleft() for i in range(4) : nx, ny = cx + dx[i], cy + dy[i] if nx >= 0 and nx = 0 ..
2023. 6. 15.
[TIL] CSAPP 9์ฅ ๊ณต๋ถ3 - ๊ฐ๋จํ ํ ๋น๊ธฐ(Implicit, first-fit)
1. ์์นจ ๋ฌธ์ ํ์ด 1. 10026๋ฒ - ์ ๋ก์์ฝ import sys from collections import deque N = int(sys.stdin.readline()) graph = [list(sys.stdin.readline().strip()) for _ in range(N)] color_count = 0 color_weakness = 0 dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def bfs(x, y) : #์์ฝ์ด ์๋ ์ฌ๋์ด ๋ณด๋ ๊ตฌ์ญ global color_count, color_weakness queue = deque() visited[x][y] = 1 queue.append((x,y)) while queue : curx, cury = queue.poplef..
2023. 5. 14.