[CLASS 4]백준 2638번 - 치즈
2638번 : 치즈 그림을 보자마자 BFS 문제라는것을 유추할 수 있다. 처음에 문제를 대충 읽어서 가장자리에는 치즈가 없다는 사실을 모르고 풀어서 코드가 좀더 길고 시간복잡도도 컸는데, 후에 깨닫고 고쳐서 괜찮은 코드가 된 것 같다. 내 코드: # dawitblog.tistory.com/158 from sys import stdin from collections import deque input = stdin.readline R,C = map(int,input().split()) mat = [] for _ in range(R): mat.append(list(map(int,input().split()))) time = 0 moves = [(0,1),(0,-1),(1,0),(-1,0)] def bfs(st..
2021. 5. 20.