The Big Prize
시간 제한1초메모리 제한1024 MB
선택한 상자 왼쪽과 오른쪽에 더 비싼 상 prize가 몇 개 있는지 알려주는 질의를 사용해 n개의 상자 중 다이아몬드가 든 상자를 찾는다.
문제
The Big Prize is a famous TV game show. You are the lucky contestant who has advanced to the final round. You are standing in front of a row of boxes, labeled through from left to right. Each box contains a prize that cannot be seen until the box is opened. There are different types of prizes. The types are numbered from to in decreasing order of value.
The prize of type is the most expensive one: a diamond. There is exactly one diamond in the boxes. The prize of type is the cheapest one: a lollipop. To make the game more exciting, the number of cheaper prizes is much larger than the number of more expensive ones. More specifically, for all such that we know the following: if there are prizes of type , there are strictly more than prizes of type .
Your goal is to win the diamond. At the end of the game you will have to open a box and you will receive the prize it contains. Before having to choose the box to open you get to ask Rambod, the host of the game show, some questions. For each question, you choose some box . As his answer, Rambod will give you an array containing two integers. Their meaning is as follows:
- Among the boxes to the left of box there are exactly boxes that contain a more expensive prize than the one in box .
- Among the boxes to the right of box there are exactly boxes that contain a more expensive prize than the one in box .
For instance, suppose that . For your question, you choose the box . As his response, Rambod tells you that . The meaning of this response is:
- Exactly one of the boxes and contains a prize more expensive than the one in box .
- Exactly two of the boxes contain a prize more expensive than the one in box .
Your task is to find the box containing the diamond by asking a small number of questions.
제한
- .
- The type of the prize in each box is between and , inclusive.
- There is exactly one prize of type .
- For all , if there are prizes of type , there are strictly more than prizes of type .
예제
이 문제는 공개된 예제가 없습니다.