#P10159. Recover the Hidden Permutation

    ID: 12148 Type: Default 1000ms 256MiB

Recover the Hidden Permutation

Recover the Hidden Permutation

You are given an unknown permutation p of length n. In an interactive setting, you are allowed to perform queries of the following form:

Choose a triple \( (l, r, k) \) satisfying \(1 \le l \le r \le n\) and \(1 \le k \le r - l + 1\). The query will return the \(k\)-th largest element among the elements \(p[l], p[l+1], \ldots, p[r]\).

Each query has a cost of \(\frac{1}{r-l+1}\). Your task is to determine the hidden permutation with a total cost not exceeding 11.8.

Note: The interactor is non-adaptive; that is, the hidden permutation is fixed before any queries are made.

For the purpose of this problem (and for testing), the hidden permutation is provided as input, so you do not actually need to simulate interactive queries. Instead, you are required to output the given permutation directly.

inputFormat

The first line contains an integer n (1 ≤ n ≤ 105), representing the length of the permutation.

The second line contains n distinct space-separated integers representing the permutation p.

outputFormat

Output the permutation p in one line, with the numbers separated by spaces.

sample

4
2 1 4 3
2 1 4 3