목록알고리즘/백준 (1)
Trulyawesome
1743(음식물 피하기) python
import sys from collections import deque input = sys.stdin.readline n,m,k = map(int, input().split()) graph = [[0]*m for _ in range(n)] visited = [[0]*m for _ in range(n)] dx = [1,0,-1,0] dy = [0,1,0,-1] def bfs(a,b): count = 1 q = deque() q.append([a,b]) visited[a][b] = 1 while q: x,y = q.popleft() for i in range(4): nx = x + dx[i] ny = y + dy[i] if 0
알고리즘/백준
2022. 12. 30. 14:02