//Patryk Grzegorczyk
#include <iostream>
#include <cmath>
using namespace std;
int n;
int t;
int lista[1048576];
int potega;
int a;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> t;
    potega = pow(2, n);
    if(t % 2 == 0){
        for(int k = 0; k < potega; k++){
            cin >> a;
            cout << a << " ";
        }
    }
    else{
        for(int i = 0; i < potega; i++){
            cin >> lista[i];
        }
        for(int j = potega - 1; j >= 0; j--){
            cout << lista[j] << " ";
        }
    }
    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 | //Patryk Grzegorczyk #include <iostream> #include <cmath> using namespace std; int n; int t; int lista[1048576]; int potega; int a; int main() { ios_base::sync_with_stdio(false); cin >> n >> t; potega = pow(2, n); if(t % 2 == 0){ for(int k = 0; k < potega; k++){ cin >> a; cout << a << " "; } } else{ for(int i = 0; i < potega; i++){ cin >> lista[i]; } for(int j = potega - 1; j >= 0; j--){ cout << lista[j] << " "; } } return 0; } | 
 
            
         English
                    English