[Algorithm] 백준 1926 그림 | 파이썬 BFS
※ 1926 그림https://www.acmicpc.net/problem/1926 문제 해결 TIPbfs로 간단하게 풀 수 있다. 유기농 배추 문제와 비슷하다. 전체 코드from collections import dequegraph = []n, m = map(int,input().split())for i in range(n): graph.append(list(map(int,input().split())))#graph = [[1, 1, 0, 1, 1], [0, 1, 1, 0, 0], [0, 0, 0, 0, 0], [1, 0, 1, 1, 1], [0, 0, 1, 1, 1], [0, 0, 1, 1, 1]]dx = [-1,1,0,0]dy = [0,0,-1,1]def bfs(x,y): graph[x][..
2024. 7. 16.