Processing math: 100%

Problem #269

Escaping the Elf

You are trapped at the center of a big circle of radius 10^9 units by a mischievous magical elf. Every minute he asks you to choose a direction in which you want to move. In the ith minute, you will be allowed to move exactly ‘i’ units in that direction.

However, the elf wants to make it hard for you to escape, so every time you choose any direction he decides whether he wants to allow you to move in the chosen direction or in the direction exactly opposite to your choice. So, if you choose to move towards the left, then the elf can force you to move towards the right, or may allow you to move left.

You must take exactly ‘i’ steps in the ith minute. Find the time in minutes required to escape if both you and the elf play optimally.

Note: 'Escaping' refers to reaching a point that is outside of the circle.

Contributed by Kalptaru Agarwal

Solved by 93 users

Log in to submit answers.

Is something wrong?

Maintaining a collection of high quality questions is our top priority. If, however, you do find an error, report the problem and we'll make sure it is reviewed soon.