Road and destination

当与所爱之人共同踏上人生的旅程时,最终的目的地变得不那么重要,关键在于这段旅程的质量与体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 When we travel life's road with those we love, the point of final destination is secondary to the quality of our journey!
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 N spots in the jail and M M roads connecting some of the spots. JOJO finds that Pucci knows the route of the former ( K − 1 ) (K−1)-th shortest path. If Pucci spots JOJO in one of these K − 1 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 K-th quickest path to get to the destination. What's more, JOJO only has T T units of time, so she needs to hurry. JOJO starts from spot S S, and the destination is numbered E 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 T units of time. Input There are at most 50 50 test cases. The first line contains two integers N N and M M ( 1 ≤ N ≤ 1000 , 0 ≤ M ≤ 10000 ) (1≤N≤1000,0≤M≤10000). Stations are numbered from 1 1 to N N. The second line contains four numbers S , E , K S,E,K and T T ( 1 ≤ S , E ≤ N 1≤S,E≤N, S ≠ E S  =E, 1 ≤ K ≤ 10000 1≤K≤10000, 1 ≤ T ≤ 100000000 1≤T≤100000000 ). Then M M lines follows, each line containing three numbers U , V U,V and W W ( 1 ≤ U , V ≤ N , 1 ≤ W ≤ 1000 ) (1≤U,V≤N,1≤W≤1000) . It shows that there is a directed road from U U-th spot to V V-th spot with time W W. It is guaranteed that for any two spots there will be only one directed road from spot A A to spot B B ( 1 ≤ A , B ≤ N , A ≠ B ) (1≤A,B≤N,A  =B), but it is possible that both directed road a n d d i r e c t e d r o a d anddirectedroad 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).的c++代码
07-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值