Softeer: [21년 재직자 대회 예선] 로드 밸런서 트래픽 예측
import sys import collections def sort_topo(g, N): indegree = [0]*(N + 1) for u, adjs in g.items(): for v in adjs: indegree[v] += 1 q = [1] order = [] while q: u = q.pop(0) order += u, for adj in g[u]: indegree[adj] -= 1 if indegree[adj] == 0: q += adj, return order def calc(g, order, N, K): loads = collections.defaultdict(int) loads[1] = K for u in order: num_adj = len(g[u]) if 0 == num_adj: co..
2022.01.09