파이썬)연구소2 -BOJ
from itertools import combinations from collections import deque from copy import deepcopy import sys input = sys.stdin.readline n, m = map(int, input().split()) arr = [] vi = [] for i in range(n): l = list(map(int, input().split())) arr.append(l) for j in range(len(l)): if l[j] == 2: vi.append([i, j]) result = float('inf') dx = [0, 0, -1, 1] dy = [-1, 1, 0, 0] def bfs(vir): q = deque() cnt = 0 ..
파이선) 미로만들기 - BOJ
https://www.acmicpc.net/problem/2665 from collections import deque n = int(input()) arr = [] for i in range(n): arr.append(str(input())) visit = [[False for _ in range(n)] for _ in range(n)] q = deque() q.append((0, 0, 0)) visit[0][0] = True dx = [0, 0, -1, 1] dy = [1, -1, 0, 0] while q: x, y, cnt = q.popleft() if x == n-1 and y == n-1: print(cnt) break for i in range(4): nx = dx[i] + x ny = dy[..