| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 256 MB | 167 | 113 | 82 | 68.908% |
Byteasar has learnt a fabulous recursive method of shuffling a deck of cards. This algorithm can be described as follows:
Byteasar has a deck of 2ドル^n$ cards. Each of them has a number written on it. Byteasar now shuffles the deck, running the procedure described above exactly $t$ times. As it might take a great amount of time, he would like to know the final order of the cards beforehand.
The first line of the input contains two integers $n, t$ (1ドル \le n \le 20,ドル 1ドル \le t \le 10^9$). The second line contains 2ドル^n$ integers $a_1, \dots, a_{2^n}$ (1ドル \le a_i \le 10^9$); $a_i$ is the number written on the $i$-th topmost card in the deck.
In the first and only line of output print 2ドル^n$ integers -- the numbers written on the cards of Byteasar's deck after $t$ shuffles. Print the numbers in the order from the topmost to the bottommost card.
2 1 2 4 1 5
5 1 4 2