#include #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) using namespace std; typedef long long llint; namespace Circu { const int MAXV = 500; const int MAXE = 500; int V, E; int how[MAXV], good[MAXV], bio[MAXV], cookie = 1; llint dist[MAXV]; int from[MAXE], to[MAXE]; llint cap[MAXE], cost[MAXE]; void init(int n) { V = n; E = 0; } void edge(int x, int y, llint c, llint w) { from[E] = x; to[E] = y; cap[E] = c; cost[E] = +w; ++E; from[E] = y; to[E] = x; cap[E] = 0; cost[E] = -w; ++E; } void reset() { REP(i, V) dist[i] = 0; REP(i, V) how[i] = -1; } bool relax() { bool ret = false; REP(e, E) if (cap[e]) { int x = from[e]; int y = to[e]; if (dist[x] + cost[e] < dist[y]) { dist[y] = dist[x] + cost[e]; how[y] = e; ret = true; } } return ret; } llint cycle(int s, bool flip = false) { llint sum = 0; int x = s; do { int e = how[x]; if (flip) --cap[e], ++cap[e^1]; sum += cost[e]; x = from[e]; } while (x != s); return sum; } llint push(int x) { for (++cookie; bio[x] != cookie; x = from[how[x]]) { if (!good[x] || how[x] == -1 || cap[how[x]] == 0) return 0; bio[x] = cookie; good[x] = false; } return cycle(x) >= 0 ? 0 : cycle(x, true); } llint run() { reset(); llint ret = 0; REP(step, 2*V) { if (step == V) reset(); if (!relax()) continue; REP(i, V) good[i] = true; REP(i, V) if (llint w = push(i)) ret += w, step = 0; } return ret; } } int ns=1; pair genBadGraph(llint k){ if (k==1){ int s=ns++; int t=ns++; int v1=ns++; int v2=ns++; Circu::edge(v1, v2, 1, -1); Circu::edge(s, v1, 1, -1); Circu::edge(s, v2, 1, -1); Circu::edge(v1, t, 1, -1); Circu::edge(v2, t, 1, -1); return {s, t}; } else{ int s=ns++; int t=ns++; pair r=genBadGraph(k-1); llint c=(1ll< st=genBadGraph(24); Circu::edge(st.second, st.first, 1e9, 0); cout<<"Vertices "<