WA in WALKFAST

https://www.codechef.com/problems/WALKFAST : problem
https://www.codechef.com/viewsolution/33551457 : my solution

the logic i used:-
so there can be only 2 ways to get from a to b
case 1: direct walk from a to b
so time1= abs(x[a]-x[b])*p; ( x array is used to store position of city values)
case 2: go from a to c , time2=abs(x[a]-x[c])*p;
if(time2<y)
time2=y;
then take train from c to d and then walk from d to b;
then i compare which time is smaller.
i tried some cases on my codeblocks and answer came to be correct, by it says
WA when i submit.
thank you for helping guys :smiley:
sorry if i am missing something obvious :sweat_smile:

Consider the following test input, adapted from that of the sample test input:

3
4 1 3 2 4 3 2 4
1 2 3 4
4 1 3 2 4 3 2 4
1 2 3 4
4 1 3 2 4 3 2 4
1 2 3 4
1 Like