CSES - Download Speed

Author: Dong Liu

Time Complexity: O(N2M)\mathcal O(N^2 \cdot M)

Just find the max flow of the graph using your favourite max flow algorithm.

C++

The code below uses Dinic's maxflow algorithm.

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define f first
#define s second
#define pb push_back
#define all(x) begin(x), end(x)

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!