#M005. [模板题]无源汇有上下界可行流
[模板题]无源汇有上下界可行流
Problem Description
This is a template problem.
There are nodes and edges. Each edge has a lower bound and an upper bound . The task is to find a feasible solution such that all nodes satisfy flow balance conditions, and all edges satisfy flow restrictions.
Input Format
The first line contains two positive integers, and .
The next lines each contain four integers: , , , and .
Output Format
If there is no solution, print a single line with NO
.
Otherwise, print YES
on the first line, followed by lines, each containing one integer representing the flow on each edge.
4 6
1 2 1 2
2 3 1 2
3 4 1 2
4 1 1 2
1 3 1 2
4 2 1 2
NO
4 6
1 2 1 3
2 3 1 3
3 4 1 3
4 1 1 3
1 3 1 3
4 2 1 3
YES
1
2
3
2
1
1
Constraints and Hints
$1 \leq n \leq 200, 1 \leq m \leq 10200, 1 \le s,t \le n, 0 \le \text{lower} \le \text{upper} < 3000$