1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include <iostream>
int main()
{
 int n,t,tab[20];
 std::cin >> n >> t; n=1<<n;
 for (int i = 0; i < n; i++)
 {
   std::cin >> tab[i];
 }
 if (t%2)
  for (int i = n; i--;)
   std::cout << tab[i] << " ";
 else
  for (int i = 0; i < n; i++)
   std::cout << tab[i] << " ";
}