Made In Heaven
One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her. There are N spots in the jail and MM roads connecting some of the spots. JOJO finds that Pucci knows the route of the former (K−1)-th shortest path. If Pucci spots JOJO in one of these K−1 routes, Pucci will use his stand Whitesnake and put the disk into JOJO's body, which means JOJO won't be able to make it to the destination. So, JOJO needs to take the K-th quickest path to get to the destination. What's more, JOJO only has T units of time, so she needs to hurry.
JOJO starts from spot S, and the destination is numbered E. It is possible that JOJO's path contains any spot more than one time. Please tell JOJO whether she can make arrive at the destination using no more than T units of time.
Input
There are at most 50 test cases.
The first line contains two integers N and M(1≤N≤1000,0≤M≤10000). Stations are numbered from 1 to N.
The second line contains four numbers S,E,K and T ( 1≤S,E≤N, S≠E, 1≤K≤10000, 1≤T≤100000000 ).
Then M lines follows, each line containing three numbers U,V and W (1≤U,V≤N,1≤W≤1000) . It shows that there is a directed road from U-th spot to V-th spot with time W.
It is guaranteed that for any two spots there will be only one directed road from spot AA to spot BB (1≤A,B≤N,A≠B), but it is possible that both directed road <A,B><A,B> and directed road <B,A><B,A>exist.
All the test cases are generated randomly.
Output
One line containing a sentence. If it is possible for JOJO to arrive at the destination in time, output "yareyaredawa"
(without quote), else output "Whitesnake!"
(without quote).
样例输入
2 21 2 2 141 2 52 1 4
样例输出
yareyaredawa
题目来源
题意
N个点,M条边,起始点为s,结束为n,求s到n的第k短的路的长度,判断长度是否大于T,如果大于,输出“Whitesnake!
”,否则输出“yareyaredawa
”
这个题和基本上一样,就多了一个和T的比较,找了模板改改就过了,。//注意输出的W是大写
AC代码
#include#include #include #include #include #include #include