Im using bfs to find the max cost for every car then printing the max
the steps must go throw cells with the same parity than the first cell but you are keeping just even valued cells. May be others errors but you can check that first
but in problem its mentioned he can jump only through even numbered to even numbered
no, it states that A[i]%2 == A[j]%2. If A is odd it will always jump between odd valued cells
Bro I hv checked everything but still WA pls help😥
It is not just a small bug, you must rethink the problem from the beginning. Even if you drive it to work, it will TLE since it is O (N ^ 2).
As stated above, you must write the logic, it would be useful even for you and it is very likely that you can find the errors without the help of others.
Yes bro u r right but i also thought of TLE but its not giving TLE its giving WA i have connected all vertices with same a%2 and if the dis is less than k then i used bfs from last vertex nd checked if it can reach n+1 if yes i printed the distance else -1
I tried doing this problem too, i also had tried it during this contest. i had 6 wrong submisison in contest and recently got 4 wrong.
here is my latest submission : https://www.codechef.com/viewsolution/36080176.
i dont understand what is wrong with this code ?