Jack and Jill
시간 제한2초메모리 제한256 MB
대화형 숫자 맞히기 게임에서 질의마다 이전 답과 모순되지 않게 답해 가능한 범위를 유지하면서, Jack이 최소 30번 질문하도록 만든다.
문제
This is an interactive problem.
Jack and Jill play "guess the number". Initially, Jill has to choose a secret number: an integer from to . After that, Jack asks questions in the form "is it the number ?" with some integer from to . For each question, Jill has to answer either "yes", or "no, my number is greater", or "no, my number is less". The game ends when Jack correctly guesses the secret number, or after questions if it does not happen by then.
Despite Jack's best efforts, he was not able to guess the number in less than questions. He realized that Jill is cheating: instead of choosing a secret number in advance, she answers the questions in such a way that the game lasts long enough. Jack pondered: how does she do that?
This is an interactive problem: you play as Jill, and the jury plays as Jack. Your task is to answer the questions in such a way that Jack asks at least questions before the game ends. Keep in mind that your answers should not contradict each other: otherwise, Jack will immediately call you out on it!
힌트
In the first example, Jack says numbers , , , and so on. In the second example, Jack says numbers , , , and so on. He is guaranteed to follow these two strategies in the first two tests.
In both examples, Jill just chose as the secret number in advance. Your solution may of course use any other strategy.