程序设计在线评测(Online Judge)

2017年湖南科技大学大学生计算机程序设计竞赛初定于12月17日举行!有意参赛请加QQ群“湖科大程序设计校赛群(369699377)”

问题 1065. -- 2010欧洲西南分区赛:Locks and keys

1065: 2010欧洲西南分区赛:Locks and keys

时间限制: 1 Sec  内存限制: 128 MB
提交: 0  解决: 0
[提交][状态][讨论版]

题目描述

A wizard is in a labyrinth where there are V rooms and V

输入

The rst line of each case contains four integers: the number V of rooms in the maze (1 <= V <= 1 500),
the number C of locks (0 <= C < V ), and rooms X and Y numbered 0; 1; : : : ; V

输出

There is one line of output per test case. If there is no solution, output Impossible. Otherwise print the
full path corresponding to your solution in the format L: V0 : : : VL, where L <= 4(C + 1)V is the length of a
path from X to Y , and X = V0; V1; : : : ; VL

样例输入

1 0 0 0


3 1 0 2
1
0 1 -1
0 2 0

3 2 0 2
1 2
0 1 1
0 2 0

5 3 0 4
2 0 3
0 1 0
0 2 -1
1 3 1
2 4 2

0 0 0 0

样例输出

0: 0
3: 0 1 0 2
Impossible
10: 0 2 0 1 0 1 3 1 0 2 4

提示

来源

[提交][状态][讨论版]