Game With Permutations
시간 제한2초메모리 제한512 MB
각 질의 순열 Q에 대해 |P_i - Q_i|를 정렬한 값을 받아 240번 이내의 질의로 숨겨진 순열 P를 알아낸다.
문제
This is an interactive problem.
A game with permutations has the following rules. The judge program first generates some permutation of length and tells you . This permutation is never changed throughout the game.
Your task is to guess the permutation. For that purpose, you may use permutations of length as queries. Let's see how the jury program answers them.
- When the jury program receives a permutation , it checks positions of each integer from 1 to in this permutation. For example, for permutation , we get .
- Same calculation is applied to the permutation , and integers are calculated. For example, for permutation , we get .
- Finally, the jury program calculates an array such that and returns it to your program sorted in ascending order.
- For the example above, , and you will receive these integers in sorted order: .
Note that you can ask no more than 240 queries before you tell the answer.