#include<cstdio>
#include<algorithm>
#include <bits/stdc++.h>
using namespace std;
int n, t, pot;
int tab[1048580];
int main()
{
    scanf("%d%d", &n, &t);
    pot= pow(2, n);
    for(int i=0; i<pot; i++)
    {
        scanf("%d", &tab[i]);
        if(t%2==0)printf("%d ", tab[i]);
    }
    if(t%2==0)return 0;
    reverse(tab, tab+pot);
    for(int i=0; i<pot; i++)printf("%d ", tab[i]);
}
        | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include<cstdio> #include<algorithm> #include <bits/stdc++.h> using namespace std; int n, t, pot; int tab[1048580]; int main() { scanf("%d%d", &n, &t); pot= pow(2, n); for(int i=0; i<pot; i++) { scanf("%d", &tab[i]); if(t%2==0)printf("%d ", tab[i]); } if(t%2==0)return 0; reverse(tab, tab+pot); for(int i=0; i<pot; i++)printf("%d ", tab[i]); } | 
 
            
         English
                    English