for this problem 1237B - Balanced Tunnel , This is my approach 309018105
I am starting from behind in second array and if a Car has moved backwards that is its position in coming out array is greater that coming in array then make it a victim and then for all cars coming before it check if they have crossed it until we find new victim and update it too and check for them too.
My thinking is that any car that has been overtaken will go back unless it overtakes someone else. So there is always a victim and so it should work. But it doesn't is there a case i am missing because in 4th test case i am missing the answer by big difference.
I have solved the problem with brute force but it is ugly 309016497, so was wondering why this victim approach is not working.