#include <cstdio>
int main(){
int n, t;
int d[1100000];
scanf("%d%d", &n, &t);
for(int i=0; i<(1<<n); i++){
scanf("%d", &d[i]);
}
if(t%2){
for(int i=(1<<n)-1; i>-1; i--)
printf("%d ", d[i]);
}
else{
for(int i=0; i<(1<<n); i++)
printf("%d ", d[i]);
}
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <cstdio> int main(){ int n, t; int d[1100000]; scanf("%d%d", &n, &t); for(int i=0; i<(1<<n); i++){ scanf("%d", &d[i]); } if(t%2){ for(int i=(1<<n)-1; i>-1; i--) printf("%d ", d[i]); } else{ for(int i=0; i<(1<<n); i++) printf("%d ", d[i]); } return 0; } |
English