최대유량2 AtCoder ABC 263 풀이 https://atcoder.jp/contests/abc263/tasks Tasks - LINE Verda Programming Contest(AtCoder Beginner Contest 263) AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online. atcoder.jp A. 정렬후 케이스를 잘 나눠주면 됩니다. #include using namespace std; int main() { ios::sync_with_stdio(0), cin.tie(0); int a[5]; for (int i = 0; i > a[i]; sor.. 2022. 8. 28. 플로우 - Dinic, Edmonds-Karp 알고리즘 1. [ Dinic ] const int MAX = 808; vectorg[MAX]; int work[MAX], lv[MAX], cap[MAX][MAX], flow[MAX][MAX]; struct Dinic { void add(int u, int v, int c) { g[u].push_back(v); g[v].push_back(u); cap[u][v] += c; } bool bfs(int S, int T) { memset(lv, -1, sizeof(lv)); queueq; lv[S] = 0; q.push(S); while (q.size()) { int cur = q.front(); q.pop(); for (int nxt : g[cur]) { if (lv[nxt] == -1 && cap[cur][nxt] .. 2022. 8. 8. 이전 1 다음