eolymp
bolt
Try our new interface for solving problems
Problems

Find The Lap Length

Find The Lap Length

This is an interactive problem.

You are controlling the robot that is placed on the stadium with an integer length. Initially robot is placed at the starting point.

The robot accepts the command "run k", that orders it to move along the distance exactly k meters counterclockwise from its current location and report total number of whole laps it passed while performing this and all previous commands (i.e. number of times the robot returned to the starting point after the start of race).

Your task is to determine the lap length using no more than 100 commands.

Interaction Protocol

The interaction is started by your program sending the line containing the query "run k" (1k109) where k is the distance that robot shall pass. Then the jury program prints one integer - total number of the whole laps that are passed after robot ends the movement (the lap is considered passed if the robot is moved through the starting point or stops in it after end of command).

You may assume that the lap length is integer between 1 and 109 inclusively.

You may use no more than 100 "run" commands.

If you are ready to print the answer, use the command "ensure s" where s is the lap length. After printing the answer the program shall terminate immediately.

For the correct interaction print the end-of-line after each query and the "ensure" command and flush the output bu er with the respective functions of your programming language:

  • cout.flush() or fflush(stdout) for C/C++;
  • stdout.flush() for Python;
  • look your language documentation for the other languages.
Time limit 1 second
Memory limit 128 MiB
Input example #1
1

1

2

3
Output example #1
run 5

run 2

run 4

run 1

ensure 4
Source 2022 Azerbaijan ICPC Qualification