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

sorry if i am missing something obvious