#include"bits/stdc++.h"
using namespace std;
int n, x, t;
vector<int> V[2];
void wczytaj()
{
cin>>n>>t;
for(int i=0; i<(1<<n); i++)
{
cin>>x;
V[0].push_back(x);
}
for(int i=(1<<n)-1; i>=0; i--)
V[1].push_back(V[0][i]);
}
void wypisz()
{
for(int i=0; i<(1<<n); i++)
cout<<V[t%2][i]<<" ";
}
int main()
{
wczytaj();
wypisz();
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 | #include"bits/stdc++.h" using namespace std; int n, x, t; vector<int> V[2]; void wczytaj() { cin>>n>>t; for(int i=0; i<(1<<n); i++) { cin>>x; V[0].push_back(x); } for(int i=(1<<n)-1; i>=0; i--) V[1].push_back(V[0][i]); } void wypisz() { for(int i=0; i<(1<<n); i++) cout<<V[t%2][i]<<" "; } int main() { wczytaj(); wypisz(); return 0; } |
English