Eight Sins

1부터 k 사이의 증가하는 n개 정수를 비교 질의로 알아내는 문제로, 상호작용기는 어떤 유효한 수열과도 모순되지 않게 응답을 조정할 수 있다.

어려움8이분 탐색구간그리디게임 이론아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Does every interactive problem have to be binary search?

Somebody has secretly set nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n such that 1a_1<a_2<<a_nk1 \le a\_1 < a\_2 < \ldots < a\_n \le k. You have to guess these integers one by one interacting with the testing system.

Initially i=1i = 1. To make a guess, you may send an integer xx such that 1xk1 \le x \le k. The system will reply with a string containing a single character:

  • ">" if a_i>xa\_i > x;
  • "<" if a_i<xa\_i < x;
  • "=" if a_i=xa\_i = x.

In case a_i=xa\_i = x, the value of ii is increased by 1. You win after you guess all nn integers correctly, that is, when ii reaches n+1n + 1.

Note that the values of a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n are not chosen in advance by the interactor, but all replies to your queries will be consistent with some valid set of a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n at any time.