[백준] 2146번 - 다리 만들기 (파이썬)
# 다리 만들기 from collections import deque import sys input = sys.stdin.readline MAX = sys.maxsize N = int(input()) arr = [] sea = [] for i in range(N): arr.append(list(map(int, input().split()))) for j in range(N): if arr[i][j] == 0: sea.append((i, j)) dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] result = MAX def bfs(a, b): global result q = deque() q.append((a, b)) visited = [[0] * N for _ in range(N)] w..
2022. 1. 28.