#P4126. [AHOI2009] 最小割
[AHOI2009] 最小割
Description
Countries are at war. In country ’s supply transport network, there are transshipment stations and directed roads. Suppose the -th () road connects stations , meaning that station can reach station via this road. Cutting this road costs .
Country wants to find a set of roads to cut so that station cannot reach station , and the total cutting cost is minimized.
Xiao Keke immediately recognizes that this is a minimum cut problem. But the thoughtful Xiao Keke goes further. For each directed road, he asks two questions:
- Question 1: Does there exist a minimum-cost cut in which this road is cut?
- Question 2: Is this road cut in every minimum-cost cut?
Please answer these two questions.
Input Format
The first line contains positive integers: .
Each of the next lines contains positive integers , indicating a directed road from station to station , with cutting cost ().
Note: There may be multiple roads directly connecting the same pair of stations. Within the same line, adjacent numbers may be separated by one or more spaces.
Output Format
For each directed road, in the input order, output one line containing two integers, each either or . They are the answers to Question 1 and Question 2 respectively ( means yes, means no). Separate the two numbers on the same line with a single space, and do not print extra spaces at the beginning or end of the line.
6 7 1 6
1 2 3
1 3 2
2 4 4
2 5 1
3 5 5
4 6 2
5 6 3
1 0
1 0
0 0
1 0
0 0
1 0
1 0
Hint
Let the edge given on line be labeled as edge . Then are the only three minimum-cost cuts. Their union is , and their intersection is .
The scale of the testdata is shown in the table below.
| Testdata ID | N | M | Testdata ID | N | M |
|---|---|---|---|---|---|
| 1 | 10 | 50 | 6 | 1000 | 20000 |
| 2 | 20 | 200 | 7 | 40000 | |
| 3 | 200 | 2000 | 8 | 2000 | 50000 |
| 4 | 9 | 3000 | 60000 | ||
| 5 | 1000 | 20000 | 10 | 4000 |
Translated by ChatGPT 5
京公网安备 11011102002149号