Tip 1: Let us suppose that we give you a maximal flow as an input and you want to minimize the cost. Can you solve this problem? Tip 2: The solution is just max_F( cost of flow with pipe of flow ≤ F / F) Tip 3: Apply solution of tip 1 for each possible maximal value of flow (1..1000) and use Tip 2.