#include <bits/stdc++.h>
using namespace std;
void scanint(int &x)
{
 register int c = getchar_unlocked();
 x = 0;
 for(;(c<48 || c>57);c = getchar_unlocked())
  ;
 for(;c>47 && c<58;c = getchar_unlocked()) 
 {
   x = (x<<1) + (x<<3) + c - 48;
 }
}
int main() {
	int n,t;
	cin>>n>>t;
	int tab[(int)pow(2,n)];
	for(int i =0;i<pow(2,n);i++)
	{
		scanint(tab[i]);
	}
	if(t%2==1)
	{
		for(int i =pow(2,n)-1;i>=0;i--)
		{
			cout<<tab[i]<<' ';
		}
	}
	else
	{
		for(int i =0;i<pow(2,n);i++)
		{
			cout<<tab[i]<<' ';
		}
	}
	return 0;
}
        | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include <bits/stdc++.h> using namespace std; void scanint(int &x) { register int c = getchar_unlocked(); x = 0; for(;(c<48 || c>57);c = getchar_unlocked()) ; for(;c>47 && c<58;c = getchar_unlocked()) { x = (x<<1) + (x<<3) + c - 48; } } int main() { int n,t; cin>>n>>t; int tab[(int)pow(2,n)]; for(int i =0;i<pow(2,n);i++) { scanint(tab[i]); } if(t%2==1) { for(int i =pow(2,n)-1;i>=0;i--) { cout<<tab[i]<<' '; } } else { for(int i =0;i<pow(2,n);i++) { cout<<tab[i]<<' '; } } return 0; } | 
 
            
         English
                    English