Does every interactive problem have to be binary search?
Somebody has secretly set n integers a_1,a_2,…,a_n such that 1≤a_1<a_2<…<a_n≤k. You have to guess these integers one by one interacting with the testing system.
Initially i=1. To make a guess, you may send an integer x such that 1≤x≤k. The system will reply with a string containing a single character:
- "
>" if a_i>x;
- "
<" if a_i<x;
- "
=" if a_i=x.
In case a_i=x, the value of i is increased by 1. You win after you guess all n integers correctly, that is, when i reaches n+1.
Note that the values of a_1,a_2,…,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_n at any time.