-----
A, B, C
|A| = |B| = |C| = n
f (a, b, c) = w1[a, b] + w2[b, c] + w3[c, a]
sum f (a, b, c) --> min
[i, set1, set2] : 2^n * 2^n * n --> o(4^n)
------
A, B
|A| = |B| = n
weight[a, b] <---- Вес ребра
sum w[a, b] --> min
[i, set]
[n, 2^n]
dp[i, set]
answer = dp[n, 2^n - 1]
[i, set] ---> [i + 1, set | 2^j]
Обычная динамика:
Memory = 2^n * n
Time = 2^n * n * n
Ленивая динамика:
Memory = 2^n
Time = 2^n * n
i = |set|
n <= 25