问题 H: SECRET

问题 H: SECRET

时间限制: 1 Sec  内存限制: 128 MB
提交: 17  解决: 4
[状态] [讨论版] [提交] [命题人:]
题目描述

Dr.Kong is constructing a new machine and wishes to keep it secret as long as possible. He has

hidden in it deep within some forest  and needs to be able to get to the machine  without being

detected.  He must make a total of T (1 <= T <= 200) trips to the  machine during its

construction. He has a secret tunnel that he uses only for the return trips.

 

The forest comprises N (2 <= N <= 200) landmarks (numbered 1..N)  connected by P (1 <= P

<= 40,000) bidirectional trails (numbered  1..P) and with a positive length that does not exceed

1,000,000.  Multiple trails might join a pair of landmarks.

 

To minimize his chances of detection, Dr.Kong knows he cannot use any  trail on the forest

more than once and that he should try  to use the shortest trails.

 

Help Dr.Kong get from the entrance (landmark 1) to the secret  machine  (landmark N) a total of

T times.  Find the minimum possible length of the longest single trail that he will have to use,

subject to the  constraint that he use no trail more than once.

 

 (Note well: The goal is to minimize the length of the longest trail, not the sum of the  trail

lengths.)

 

It is guaranteed that  Dr.Kong can make all T trips

输入

  Line 1:       Three space-separated integers: N, P, and T

Lines 2..P+1:  Line i+1 contains three space-separated integers, A_i,  B_i, and L_i,

 indicating that a trail connects landmark A_i to  landmark B_i with length L_i.

输出

Line 1:    A single integer that is the minimum possible length of the  longest segment of 

Dr.Kong 's route.

样例输入 Copy
7 9 2 
1 2 2
2 3 5
3 7 5
1 4 1
4 3 1
4 5 7
5 7 1
1 6 3
6 7 3
样例输出 Copy
5