Hi All!!
I am learning max-flow these days..I got a problem from 2008 ICPC Beijing regionals that am finding hard to solve.Could anyone please help..Problem statement is as follows.
Gabiluso is one of the greatest spies in his country. Now he’s trying to complete an “impossible” mission — to make it slow for the army of City Colugu to reach the airport. City Colugu has n bus stations and m roads. Each road connects two bus stations directly, and all roads are one way streets. In order to keep the air clean, the government bans all military vehicles. So the army must take buses to go to the airport. There may be more than one road between two bus stations. If a bus station is destroyed, all roads connecting that station will become no use. What’s Gabiluso needs to do is destroying some bus stations to make the army can’t get to the airport in k minutes. It takes exactly one minute for a bus to pass any road. All bus stations are numbered from 1 to n. The No.1 bus station is in the barrack and the No. n station is in the airport. The army always set out from the No. 1 station. No.1 station and No. n station can’t be destroyed because of the heavy guard. Of course there is no road from No.1 station to No. n station. Please help Gabiluso to calculate the minimum number of bus stations he must destroy to complete his mission.
Constraints:
(0 < n ≤ 50, 0 < m ≤ 4000, 0 < k < 1000)
In short::Remove minimum number of vertices in graph such that shortest path from source to destination is of length greater than K..








Graph Construction:
1)Split every node (except first and last) into two. Add an edge of unit capacity, 0 cost between them.
2)Add an edge of infinite capacity,unit cost between the vertices given in the input.
Now, while shortest path between source(1) and sink(N) is <= k, push one more unit of flow and increment your answer by one. This will remove one more vertex (min-cut equals max flow) along the current shortest path. So after every iteration your shortest path will increase/remain constant.
Consider the case: no. of vertices=11,number of edges=12,k=7
edges: 1-2
2-3
3-4
4-11
3-5
5-6
6-11
5-7
7-8
8-9
9-10
10-11
Now the optimal answer would be 2,deleting the vertex 4,6 But according to what you said vertex 2 will be split up in 2 parts with unit capacity between them.So after sending flow along minimum cost path i.e. 1-2-3-4-7 i would have the flow between the two splits of vertex 2 as 1,which is same as its capacity,so i could send no more flow after it,and the algorithm would terminate as i won't be able to send any more flow along another path,hence the answer according to your algorithm should be 1,rather than 2,am i understanding your algorithm correctly??
The answer is 1. Graph
You can remove vertex 2,and 11 will no longer reachable from 1 in <=7 moves
(http://mxwell.github.io/draw-graph/?q=graph{1--2;2--3;3--4;4--11;3--5;5--6;6--11;5--7;7--8;8--9;9--10;10--11})
I'm not sure I understand the solution. I should push one more unit of flow through the shortest path, right? But then wouldn't I end up removing more than one vertex?
For example, for these two test cases and K = 5, the answer is 2 and 1, I believe. If I understood correctly, in the second case it works fine. But in the first case, if I push a unit of flow through 1 -> 7 -> 8 -> 9, wouldn't it give answer 1?