너비 우선 탐색

15684번 – 사다리조작

1

문제 풀이 코드 n, m, h = map(int, input().split()) arr = [list(map(int, input().split())) for _ in range(m)] board = [[0]*n for _ in range(h)] for y, x in arr: board[y-1][x-1] = 1 def run(): for i in range(n): y, x = (0, i) while(y != h): if board[y][x] == 1: x = x+1 # 오른쪽 elif(x > 0 and board[y][x-1] == 1): x = x-1 # 왼쪽 y = y+1 if x != i: return False return True def DFS(startY, depth, maxDepth): if...

15683번 – 감시

1

문제 풀이 코드 from copy import deepcopy from math import inf r, c = map(int, input().split()) board = [list(map(int, input().split())) for _ in range(r)] EMPTY, WALL, LIGHT, _min = (0, 6, '#', inf) board = [[WALL]*c] + board + [[WALL]*c] for y in range(len(board)): board[y] = [WALL] + board[y] + [WALL] CCTVS = [] for y in range(len(board)): for x in range(len(board[y])): if 1 <= board[y][x] <=...