[백준] 4179번 - 불! (파이썬)
# 불! from collections import deque import sys input = sys.stdin.readline dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] N, M = map(int, input().split()) arr = [] now = deque() fire = deque() for i in range(N): arr.append(list(input().strip())) for j in range(M): if arr[i][j] == 'J': now.append((i, j)) arr[i][j] = 1 if arr[i][j] == 'F': fire.append((i, j)) def move(): leng = len(now) for _ in range(leng):..
2022. 3. 3.
[백준] 17472번 - 다리 만들기 2 (파이썬)
# 다리 만들기 2 from collections import deque import sys input = sys.stdin.readline MAX = sys.maxsize dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] N, M = map(int, input().split()) land = [] arr = [] for i in range(N): arr.append(list(map(int, input().split()))) for j in range(M): if arr[i][j] == 1: land.append((i, j)) def find_land(visited, a, b, num): q = deque() q.append((a, b)) while q: x, y = q.popleft(..
2022. 2. 19.