| ||There is a country with N cities. The cities are numbered 0 through N-1. There are some bidirectional roads in the country. Each road connects a pair of cities. More precisely, for each i, road i connects the cities A[i] and B[i].
Limit is a deer that likes to travel along the roads. Traveling along road i (in either direction) takes him exactly D[i] minutes. Limit does not like cities, so he never waits in a city.
Limit is currently in the city 0, starting his travels. In exactly T minutes, he wants to be in the city N-1.
You are given the int N; the ints A, B, and D; and the long T.
Return "Possible" (quotes for clarity) if Deer Limit can reach city N-1 in exactly T minutes.
Otherwise, return "Impossible".
|Parameters:||int, int, int, int, long|
|Method signature:||String isAble(int N, int A, int B, int D, long T)|
|(be sure your method is public)|
|-||N will be between 2 and 50, inclusive.|
|-||A will contain between 1 and 50 elements, inclusive.|
|-||A, B and D will each contain the same number of elements.|
|-||Each element in A and B will be between 0 and N-1, inclusive.|
|-||Each element in D will be between 1 and 10,000, inclusive.|
|-||For each valid i, A[i] and B[i] will be different.|
|-||No two roads will connect the same pair of cities.|
|-||T will be between 1 and 10^18, inclusive.|
|city 0 -> city 1 -> city 2 is a valid way.|
|city 0 -> city 2 -> city 1 -> city 0 -> city 2 is a valid way.|
|Here, Limit just travels back and forth between cities 0 and 1 along the only road in the country.|
|In this test case, there is absolutely no way how to reach city N-1 from city 0.|
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.