#include<bits/stdc++.h> int tab[] = {1,2,4,8,16,32,64,128,256,12,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576}; using namespace std; int main() { int n, t; vector<int> v; cin >> n >> t; for(int i = 0; i < tab[n]; i++) { int temp; cin >> temp; v.push_back(temp); } if(t%2 == 1) { reverse(v.begin(), v.end()); } for(int x : v) { cout << x << ' '; } cout << endl; }
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<bits/stdc++.h> int tab[] = {1,2,4,8,16,32,64,128,256,12,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576}; using namespace std; int main() { int n, t; vector<int> v; cin >> n >> t; for(int i = 0; i < tab[n]; i++) { int temp; cin >> temp; v.push_back(temp); } if(t%2 == 1) { reverse(v.begin(), v.end()); } for(int x : v) { cout << x << ' '; } cout << endl; } |