목록1707 (1)
황소개발자
백준 1707 파이썬 python : 이분 그래프 @@황소처럼 우직하게@@ 이렇게 푸는겁니당
import sys input = sys.stdin.readline def bfs_binary(v, visited, color): q = [v] visited[v] = True color[v] = 1 while q: now = q.pop(0) for nxt in adj_lst[now]: if not visited[nxt]: q.append(nxt) color[nxt] = 3 - color[now] visited[nxt] = True else: if color[now] == color[nxt]: return False return True t = int(input()) for i in range(t): n, m = map(int, input().split()) adj_lst = [[] for _ in ra..
백준 문제 풀이
2020. 3. 2. 19:14