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
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

uint32_t buf[1050000];

int main(){
    uint32_t count, iters;
    int32_t i;

    scanf("%" SCNu32" %" SCNu32 "", &i, &iters);
    count = 0x01;
    count = count << i;
    if (iters & 0x1){
        for(i = 0; i < count; ++i){
            scanf("%" SCNu32 "", buf + i);
        }
        for(i = count - 1; i >= 0; i--){
            printf("%" PRIu32 " ", *(buf + i));
        }
    } else {
        for(i = 1; i <= count; ++i){
            scanf("%" SCNu32 "", &iters);
            printf("%" PRIu32 " ", iters);
        }
    }
    return 0;
}