#include<stdio.h> #include<vector> #include<iostream> using namespace std; vector<int> talia; int main() { int n, t; scanf("%d%d", &n, &t); long long potega=1; while(n--) { potega*=2; } talia.resize(potega); if (t%2==0) { for (long long i=0; i<potega; i++) { int x; scanf("%d", &x); printf("%d ", x); } } else { for (long long i=0; i<potega; i++) { int x; scanf("%d", &x); talia[i]=x; } for (long long i=potega-1; i>=0; i--) { printf("%d ", talia[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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include<stdio.h> #include<vector> #include<iostream> using namespace std; vector<int> talia; int main() { int n, t; scanf("%d%d", &n, &t); long long potega=1; while(n--) { potega*=2; } talia.resize(potega); if (t%2==0) { for (long long i=0; i<potega; i++) { int x; scanf("%d", &x); printf("%d ", x); } } else { for (long long i=0; i<potega; i++) { int x; scanf("%d", &x); talia[i]=x; } for (long long i=potega-1; i>=0; i--) { printf("%d ", talia[i]); } } } |