Imprecise Permutation Sort

아직 제출이 없습니다시간 제한40초메모리 제한512 MB

문제

This is an interactive problem.

A permutation a\[1],a\[2],,a\[n]a\[1], a\[2], \ldots, a\[n] of integers from 11 to nn is hidden from you.

Your task is to sort it in ascending order by comparing and swapping pairs of elements. This problem could be pretty easy, but the jury member responsible for the problem was too concentrated on floating-point arithmetic in problems G and J and implemented an "imprecise" comparator:

  • if a\[i]a\[j]max(a\[i],a\[j])0.01\frac{|a\[i] - a\[j]|}{max(a\[i], a\[j])} \leq 0.01, then return 00;
  • otherwise, if a\[i]<a\[j]a\[i] < a\[j], then return 1-1;
  • otherwise, return 11.

Your program can make queries to compare any two elements with this comparator, or to swap any two elements. After each swap, it will be told whether the permutation became sorted. 

Sort a permutation of size up to 16,38416\\,384 using no more than 300,000300\\,000 queries.