QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#456. 最大流 1

統計

这是一道简单版本的最大流,你可以预期使用正确实现的 Dinic 算法或是其他算法来通过本题。

给定 $n$ 个点,$m$ 条边,给定每条边的容量,求从点 $s$ 到点 $t$ 的最大流。

输入格式

第一行四个整数 $ n , m , s , t $。

接下来的 $ m $ 行,每行三个整数 $ u , v , c $,表示 $ u $ 到 $ v $,流量为 $ c $ 的一条边。

输出格式

输出点 $ s $ 到点 $ t $ 的最大流。

样例数据

样例输入

7 14 1 7
1 2 5
1 3 6
1 4 5
2 3 2
2 5 3
3 2 2
3 4 3
3 5 3
3 6 7
4 6 5
5 6 1
6 5 1
5 7 8
6 7 7

样例输出

14

子任务

对于所有数据 $ 1 \leq n \leq 500$, $1 \leq m \leq 20\,000$, $1 \leq c \leq 10^9$

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.