SAFEROBO-ICPC ASIA REGIONALS

Problem Code: SAFEROBO
I implemented the following logic:
Since Alice jumps sa steps right and Bob jumps sb steps left, suppose they collide at a certain cell after n steps.Then ( sa x n + sb x n ) - 1 = No. of dots between A and B. Thus n = No. of dots + 1 / (sa + sb).
Is there a flaw in the logic which is giving WA for the following code : SAFEROBO

Hey,
You have made an error in the implementation of the steps function. You need to calculate the number of Dots between A and B but instead you are calculating all the dots in the given String. Better would be to just find the position of A and B in the given string and then subtract their positions to get the No of steps between the two.

1 Like

Thanks for the observation.