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
The No.1 bus station is in the barrack and the No. n
No.1 station and No. n
Please help Gabiluso to calculate the minimum number of bus stations he must destroy to complete his mission.
There are several test cases. Input ends with three zeros.
For each test case:
The first line contains 3 integers, n, m and k. (0<n<=50, 0<m<=4000, 0<k<1000)
Then m lines follows. Each line contains 2 integers, s and f , indicating that there is a road from station No. s to station No. f .
For each test case, output the minimum number of stations Gabiluso must destroy.
5 7 3 1 3 3 4 4 5 1 2 2 5 1 4 4 5 0 0 0
2
Migrated from old NTUJ.
ICPC 2008, Beijing
No. | Testdata Range | Score |
---|