시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 40 | 22 | 7 | 36.842% |
Every year, Jill takes a bicycle tour between two villages. There are different routes she can take between these villages, but she does have an upper limit on the distance that she wants to travel. Given a map of the region indicating the cities and the roads between them (and their distances), Jill would like to have a list of the various routes between the selected cities that will meet her distance requirements. Your task is to write a program that will produce a list of these routes, in increasing order of distance.
We make the following assumptions.
The input will contain several possible cases, each including a route map, identification of the start and destination villages, and the maximum distance Jill is willing to travel.
Each case appears in the input as a set of integers separated by blanks and/or ends of lines. The order and interpretation of these integers in each case is as follows:
The data for the last case will be followed by a single integer with the value –1.
For each case, display the case number (1, 2, …) on the first line of output. Then, each on a separate additional line, list the routes that Jill might take preceded by the length of the route. Order the routes first by length, from shortest to longest. Within routes having the same length, order them in increasing lexicographic order. The sample input and output provide suitable examples, and the formatting shown there should be followed closely (each village number should be separated by a single space).
Separate the output for consecutive cases by a single blank line.
불가능한 경우에는 " NO ACCEPTABLE TOURS"를 출력한다.
4 5 1 2 2 1 3 3 1 4 1 2 3 2 3 4 4 1 3 4 4 5 1 2 2 1 3 3 1 4 1 2 3 2 3 4 4 1 4 10 5 7 1 2 2 1 4 5 2 3 1 2 4 2 2 5 3 3 4 3 3 5 2 1 3 8 -1
Case 1: 3: 1 3 4: 1 2 3 Case 2: 1: 1 4 7: 1 3 4 8: 1 2 3 4 Case 3: 3: 1 2 3 7: 1 2 4 3 7: 1 2 5 3 8: 1 4 2 3 8: 1 4 3
5 7 1 2 2 1 4 5 2 3 1 2 4 2 2 5 3 3 4 3 3 5 2 1 3 1 -1
Case 1: NO ACCEPTABLE TOURS
ICPC > Regionals > North America > Pacific Northwest Regional > 2004 Pacific Northwest Region Programming Contest G번