- Figure 1 shows a ow network on which an s t ow has been computed. The capacity of each edge appears as a label next to the edge, and the numbers in boxes give the amount of ow sent on each edge. (Edges without boxed numbers have no ow being sent on them.)
- What is the value of this ow? Is this a maximum (s; t) ow in this graph?
- Find a minimum s t cut in the ow network pictured in Figure 1, and also say what its capacity is.
- Decide whether you think the following statement is true or false. If it is true, give a short explanation. If it is false, give a counterexample.
- Let G be an arbitrary ow network, with a source s, a sink t, and a positive integer capacity ce on
every edge e. If f is a maximum s t ow in G, then f saturates every edge out of s with ow (i.e., for all edges e out of s, we have f(e) = ce)
- Let G be an arbitrary ow network, with a source s, a sink t, and a positive integer capacity ce on every edge e; and let (A; B) be a minimum s t cut with respect to these capacities fce : e 2 Eg. Now suppose we add 1 to every capacity; then (A; B) is still a minimum s t cut with respect to these new capacities f1 + ce : e 2 Eg.
- When FJ’s friends visit him on the farm, he likes to show them around. His farm comprises N(1 <=
N <= 1000) elds numbered 1; 2; :::; N, the rst of which contains his house and the N th of which contains the big barn. A total M (1 <= M <= 10000) paths that connect the elds in various ways. Each path connects two di erent elds and has a nonzero length smaller than 35,000.
To show o his farm in the best way, he walks a tour that starts at his house, potentially travels through some elds, and ends at the barn. Later, he returns (potentially through some elds) back to his house again.
He wants his tour to be as short as possible, however he doesn’t want to walk on any given path more than once. Calculate the shortest tour possible. FJ is sure that some tour exists for any given farm. Input
Line 1: Two space-separated integers: N and M.
Lines 2, 3, …, M+1: Three space-separated integers that de ne a path: The starting eld, the end eld, and the path’s length.
A single line containing the length of the shortest tour.
1 2 1
2 3 1
3 4 1
1 3 2
2 4 2
- In modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can assume that people A can keep in touch with people B, only if
- A knows B’s phone number, or
- A knows people C’s phone number and C can keep in touch with B.
It’s assured that if people A knows people B’s number, B will also know A’s number.
Sometimes, someone may meet something bad which makes him lose touch with all the others. For example, he may lose his phone number book and change his phone number at the same time.
In this problem, you will know the relations between every two among N people. To make it easy, we number these N people by 1; 2; :::; N. Given two special people with the number S and T , when some people meet bad things, S may lose touch with T . Your job is to compute the minimal number of people that can make this situation happen. It is supposed that bad thing will never happen on S or T .
The rst line of the input contains three integers N (2 <= N <= 200), S and T (1 <= S; T <= N, and S is not equal to T ).Each of the following N lines contains N integers. If i knows j’s number, then the j-th number in the (i+1)-th line will be 1, otherwise the number will be 0.
You can assume that the number of 1s will not exceed 5000 in the input.
If there is no way to make A lose touch with B, print “NO ANSWER!” in a single line. Otherwise, the rst line contains a single number t, which is the minimal number you have got, and if t is not zero, the second line is needed, which contains t integers in ascending order that indicate the number of people who meet bad things. The integers are separated by a single space.
If there is more than one solution, we give every solution a score, and output the solution with the minimal score. We can compute the score of a solution in the following way: assume a solution is A1, A2, …, At (1 <= A1 < A2 < ::: < At <= N), the score will be (A1 1) Nt + (A2 1) N(t 1) + ::: + (At 1) N. The input will assure that there won’t be two solutions with the minimal score.
3 1 3
1 1 0
1 1 1
0 1 1