[백준/7576/파이썬] 토마토
소스코드 from collections import deque m, n = map(int, input().split()) matrix = [list(map(int, input().split())) for _ in range(n)] queue = deque([]) dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1] res = 0 for i in range(n): for j in range(m): if matrix[i][j] == 1: queue.append([i, j]) def bfs(): while queue: x, y = queue.popleft() for i in range(4): nx, ny = dx[i] + x, dy[i] + y if 0
[백준/14500/파이썬] 테트로미노
소스코드 (틀린풀이) from collections import deque N,M = map(int,input().split()) tetro = [] for i in range(N): tetro.append(list(map(int,input().split()))) dx = [-1,1,0,0] dy = [0,0,-1,1] def bfs(x,y): queue = deque() queue.append((x,y)) #시작 지점 queue에 삽입 SUM = tetro[x][y] Max_place = () visited = [(x,y)] for _ in range (3): #테트로미노는 자기포함 4번 움직임 poly = queue.popleft() Max = 0 nlist = [] for i in range(4):..