英语翻译While exploring his many farms,Farmer John has discovered a number of amazing wormholes.A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole!Each o
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 10:28:25
英语翻译While exploring his many farms,Farmer John has discovered a number of amazing wormholes.A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole!Each o
英语翻译
While exploring his many farms,Farmer John has discovered a number of amazing wormholes.A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole!Each of FJ's farms comprises N (1 ≤ N ≤ 500) fields conveniently numbered 1..N,M (1 ≤ M ≤ 2500) paths,and W (1 ≤ W ≤ 200) wormholes.
As FJ is an avid time-traveling fan,he wants to do the following:start at some field,travel through some paths and wormholes,and return to the starting field a time before his initial departure.Perhaps he will be able to meet himself :) .
To help FJ find out whether this is possible or not,he will supply you with complete maps to F (1 ≤ F ≤ 5) of his farms.No paths will take longer than 10,000 seconds to travel and no wormhole can bring FJ back in time by more than 10,000 seconds.
Input
Line 1:A single integer,F.F farm descriptions follow.
Line 1 of each farm:Three space-separated integers respectively:N,M,and W
Lines 2..M+1 of each farm:Three space-separated numbers (S,E,T) that describe,respectively:a bidirectional path between S and E that requires T seconds to traverse.Two fields might be connected by more than one path.
Lines M+2..M+W+1 of each farm:Three space-separated numbers (S,E,T) that describe,respectively:A one way path from S to E that also moves the traveler back T seconds.
Output
Lines 1..F:For each farm,output "YES" if FJ can achieve his goal,otherwise output "NO" (do not include the quotes).
Sample Input
2
3 3 1
1 2 2
1 3 4
2 3 1
3 1 3
3 2 1
1 2 3
2 3 4
3 1 8
Sample Output
NO
YES
英语翻译While exploring his many farms,Farmer John has discovered a number of amazing wormholes.A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole!Each o
问题是请根据题目所给的输出(就是那些数字,每一列或每一行代表什么数据应该从文章里找)判断输出是“YES”还是“NO”
他的许多农场探险时,农民约翰已经发现许多的惊人的虫孔。一个虫孔是非常特殊,因为它是一种单向的路径,提供你到达目的地时,都在你面前进入虫洞!每一个农场组成的FJ 1≤N≤N(500)1 . .顺便数领域氮、米(1≤≤2500米)的路径,以及W(1≤200 W≤)虫孔。
作为time-traveling FJ是个狂热的球迷,他想要做到以下几点:开始在一些领域,通过一些途径和旅行的虫孔,并回到首...
全部展开
他的许多农场探险时,农民约翰已经发现许多的惊人的虫孔。一个虫孔是非常特殊,因为它是一种单向的路径,提供你到达目的地时,都在你面前进入虫洞!每一个农场组成的FJ 1≤N≤N(500)1 . .顺便数领域氮、米(1≤≤2500米)的路径,以及W(1≤200 W≤)虫孔。
作为time-traveling FJ是个狂热的球迷,他想要做到以下几点:开始在一些领域,通过一些途径和旅行的虫孔,并回到首发领域之前他最初的离开。也许他将能够满足自己。
帮助FJ找出这是可能的,他都会为您提供完整的地图到外(1≤F≤5)他的农场。没有路径将超过10000秒去旅行,并且没有虫孔可以带来FJ及时返回了超过10000秒。
输入
第1行:一个整数,F . F农场描述跟随。
第1行:三space-separated每个农场的整数:氮、米,分别和W
2 . . M +线每一个农场:三space-separated编号(S、E、T),分别描述:一个双向之间的通道和E,需要教师年代秒遍历。连接两个领域可能由多个路径。
线2 . . M + M + W + 1的每个农场:三space-separated编号(S、E、T),描述一个方法,分别为:道路与年代也移动E旅行回来T秒。
输出
线1 . . F:对于每个农场,输出“是的”如果FJ可以实现他的目标,否则输出“不”(不包括引用)。
样本输入
2
三3个1
1 2两
1 - 3 4
2 ~ 3个1
3 1 - 3
3二1
1—2—3
两个三个四个
3个1 8
样本输出
没有
是的
收起