Time limit: 0.05s
Memory limit: 1MB
Input:
Output:
Task
and are playing a mind-bending game. has an unknown number, , which needs to guess. The function guess(v)
returns if , otherwise. Use the minimum number of calls to the guess
function to score points.
Interaction Protocol
The contestant must implement the function with the header:
int solve(void);
The contestant can use the function defined in interaction.h
with the header:
int guess(int val);
Constraints and clarifications
- Let be the number of calls to the
guess
function made by the contestant. - For tests worth points, can be at most .
- For the other tests, should be at most .
- You can use the sample grader from the attachments.
- This video could prove helpful in finding the point solution.
Example interaction
Let .
The grader calls the function solve()
.
The contestant guesses , where guess(6)
= .
The contestant guesses , where guess(4)
= .
The function solve()
returns .
The number of calls to the guess
function is , which is sufficient for the -point subtask but not sufficient for the rest.