Hey, I am getting wrong answer to WALKFAST problem. I tried to figure out which test case is failing but to no avail. Please help me out

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile!

Thanks! I am new to CodeChef. I just pasted the solution link instead.

Thanks Your solution gives the wrong answer for the following test input:

```
1
8 1 8 1 4 92 70 45
-70 -56 -49 -7 -1 2 19 45
```

(the answer should be `9239`

).

Thanks! It seems I was returning time instead of time1. I corrected it and your test case works now. Still, the submission is showing wrong

updated: CodeChef: Practical coding for everyone

Any help is appreciated. TIA

Whats even more interesting is that some guy copied my code (including the variable names) and submitted . He got it correct.

Here’s his code : CodeChef: Practical coding for everyone

There’s one obvious bug remaining now, and it’s an easy one - just compare your solution with @everule1’s (they are *not* identical copies of each other) and you’ll see what it is

SOLUTION IN JAVASCRIPT :-

process.stdin.resume();

process.stdin.setEncoding(‘utf8’);

var arr = ‘’;

process.stdin.on(‘data’, function (chunk) {

arr += chunk;

});

process.stdin.on(‘end’, function () {

arr = arr.split(‘\n’);

let t = Number(arr.shift());

loop: for (let s = 0; s < t; s++) {

const [n,a,b,c,d,p,q,y] = arr[s*2].split(’ ‘).map(Number);

const nArray = arr[s*2+1].split(’ ').map(Number);

const walkTime = Math.abs((nArray[b-1] - nArray[a-1])*p);

const walkToTrainTime = Math.abs((nArray[c-1] - nArray[a-1])*p);

if (walkToTrainTime > y) {

console.log(walkTime);

continue;

}

const trainTime = Math.abs((nArray[c-1] - nArray[d-1])*q);

const trainToBCityTime = Math.abs((nArray[d-1] - nArray[b-1])*p);

const viaTrainTime = y + trainTime + trainToBCityTime;

// console.log({walkTime,walkToTrainTime,trainTime,trainToBCityTime,viaTrainTime});

console.log(walkTime < viaTrainTime ? walkTime : viaTrainTime);

}

});