| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 6 | 5 | 5 | 83.333% |
This is an interactive problem.
Jury has a permutation of numbers from 1ドル$ to $n$. Your task is find positions where numbers from 1ドル$ to $k$ are placed. To do this, you can use jury's program which can compare numbers in any two positions in the permutation.
The first line of input contains two integers $n$ and $k$: the order of permutation and the number of positions to find. In all tests except the example, $n = 10,000円$ and $k \le 10$.
Then follow the answers for your requests, one per line. If the first of the two numbers to compare is less than the second one, the line will contain a single character "<", otherwise, it will contain a single character ">".
If you want to compare numbers on positions $i$ and $j,ドル you must print one line "? $i$ $j$". Here, $i$ and $j$ must be different integers between 1ドル$ and $n$. You can request a comparison at most 10ドル,700円$ times.
If you found all positions for all numbers from 1ドル$ to $k,ドル print "! $pos_1$ $pos_2$ $\dots$ $pos_k$", and then terminate your program.
To prevent output buffering, after printing each line, consider issuing the command which flushes the buffer. For example, this command may be fflush(stdout) in C or C++, System.out.flush() in Java, flush(output) in Pascal or sys.stdout.flush() in Python.
Also, don't forget to put a newline at the end of every line of your output.
3 3 (waiting for output) < (waiting for output) > (waiting for output) <
(reading input) ? 1 2 (reading input) ? 3 1 (reading input) ? 2 3 (reading input) ! 1 2 3 (terminating)
In the example, the jury's permutation is 1 2 3.