Procesor

시간 제한1초메모리 제한2048 MB

문제

Initially, Fran has an empty array $a$. Fran processes $n$ queries of the form $x$ — he appends $x$ elements to the end of $a$. After each query, Fran wants to determine the smallest element in the array $a$, and once he identifies it, he removes it from the array without altering the indices of the other elements.

Your task is to determine the smallest element of the array for each query by asking questions.

힌트

Explanation of the Sample Case:

The final array is of the form $3, 2, 4, 1, 5$.

The first query outputs $1$ because $a_1 > a_2$.

The second query outputs $0$ because $a_1 < a_3$.

The third query outputs $0$ because $a_2 < a_3$.

After this, it can be determined that $a_2$ is the smallest current element, so the output is ! $2$. The interaction continues with the subsequent queries.