Question link - CodeChef: Practical coding for everyone
solution link -CodeChef: Practical coding for everyone
It is giving WA
What is wrong in this cannot understand. All sample test cases passed.
I HAVE MADE ARRAYS FOR COUNTING DISTANCE FROM WHERE 1 COMES, AND WHERE 2 COMES. IT IS AN EASIEST APPROACH.
I couldn’t see where you enforce that destination of city 1 is always achieved at time zero, whatever trains are available, in fact even with no trains.
I have made one array to store the distance if 1 comes. similarly with two array. Can you provide some test cases that is not working. It would be great.
Exactly as @joffan says; consider the test input:
Now, this test case also works, any other test case that doesn’t work?
New_Solution - CodeChef: Practical coding for everyone
Spacing issues in your output; consider the following test input:
1 1 1
2 1 2
Finally, got CA, Thank you so so much🤩. Had tried almost 15-20 tries from last 10 days… finally got CA.