SHROUTE - problem (june long)

Question link - Contest Page | CodeChef
solution link -Solution: 47852630 | CodeChef

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.

1 Like

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:

1                    
1 1
0
1
2 Likes

Now, this test case also works, any other test case that doesn’t work?
New_Solution - Solution: 47889545 | CodeChef

1 Like

Spacing issues in your output; consider the following test input:

1
3 3
1 1 1
2 1 2
1 Like

Finally, got CA, Thank you so so much🤩. Had tried almost 15-20 tries from last 10 days… finally got CA.

1 Like