목록14502 (1)
컴공생의 다이어리
[파이썬, Python] 백준 14502번 : 연구소
백준 14502번 : 연구소 (문제 바로가기) 내 코드 import sys from collections import deque from itertools import combinations def bfs_and_count_zero(graph, virus_pos, n, m): # 너비 우선 탐색 & 빈칸 수 구하기 directions = [(1, 0), (-1, 0), (0, 1), (0, -1)] visited = [[False] * m for _ in range(n)] for i, j in virus_pos: visited[i][j] = True queue = deque(virus_pos) while queue: # 바이러스 전파하기! x, y = queue.popleft() for i in rang..
Development/Algorithm & Coding Test
2022. 6. 7. 00:01