Recently I solved an interesting constructive task. Can you solve it? I'll reveal the source a bit later.
N(N + 1) soccer players stand in a row. The height of the i-th player is hi. No two of them are of the same height.
Sir Alex wants to remove N(N−1) players from this row leaving a new row of 2N players in which the following N conditions hold:
- No one stands between the two tallest players,
- No one stands between the third and fourth tallest players,
- No one stands between the two shortest players.
Find one possible way to achieve this.
Constraints: 2 ≤ N ≤ 500, 1 ≤ hi ≤ 109, hi are pairwise distinct.