/ FtOJ / 题库 /

「模板」有源汇有上下界最大流

「模板」有源汇有上下界最大流

测试数据来自 system/1014

Description

nn 个点,mm 条边,每条边 ee 有一个流量下界 lower(e)\text{lower}(e) 和流量上界 upper(e)\text{upper}(e),给定源点 ss 与汇点 tt,求源点到汇点的最大流。

Format

Input

第一行两个正整数 nnmm

之后的 mm 行,每行四个整数 ssttlower\rm lowerupper\rm upper

Output

如果无解,输出一行 please go home to sleep

否则输出最大流。

Sample 1

Input

10 15 9 10
9 1 17 18
9 2 12 13
9 3 11 12
1 5 3 4
1 6 6 7
1 7 7 8
2 5 9 10
2 6 2 3
2 7 0 1
3 5 3 4
3 6 1 2
3 7 6 7
5 10 16 17
6 10 10 11
7 10 14 15

Output

43

Limitation

Data

1n202,1m99991 \le n \le 202,1 \le m \le 9999

Time and Space

1s, 125MB.

Source

loj #116

update by Shuchong

信息

ID
1025
难度
(无)
分类
(无)
标签
递交数
0
已通过
0
通过率
?
上传者