
[백준] 12670 The Year of Code Jam (Large) Python 3

·
코딩/백준-알고리즘
import sysfrom collections import dequeclass Dinic: def __init__(self, n): """ n: 전체 노드 수 인접 리스트 구조: adj[u] = [(v, capacity, rev), ...] - v: 다음 노드 - capacity: 잔여 용량 - rev: v의 인접 리스트에서 역방향 간선의 index """ self.n = n self.adj = [[] for _ in range(n)] def add_edge(self, u, v, cap, is_directed=True): """ ..