Comments

understood Thanks buddy

In 2228B lets say n=7 x1=1 x2=4 and k=2

1st second

-Now Remilia moves to x2=5 from x2=4 optimally, this is the optimal move for Remilia because going to x2=3 will decrease the distance between the two.

-Since Remilia chose x2=5, Reimu will try to minimize distance so he will come to x1=7 from x1=1 optimally.

2nd second -Now Remilia moves to x2=4 from x2=5 optimally.

-Since Remilia chose x2=4, Reimu will try to minimize distance so he will come to x1=6 from x1=7 optimally.

further seconds

Now Remilia cannot move anymore so she will stay at x2=4 and Reimu is at x1=6 and the difference between then is 2

So ans is 2(initial second) + 2(last differene between the two after Remilia is out of moves)=4

But according to this tutorial ans = min(7-(4-1),(4-1))+k = min(4,3)+2 = 3+2 = 5

Why?