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
40
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int n, t;
	cin >> n >> t;
	int num_kart = pow((double)2, n);
	int przod_tyl = t % 2;
	
	if (przod_tyl == 0) {
		int c;
		for(int i=0; i < num_kart; i++) {
			cin >> c;
			cout << c << " ";	
		}
	}
	else {
		int karty[num_kart];
		
		for (int i=0; i < num_kart; i++) {
			cin >> karty[i];
		}
		
		int j = num_kart - 1;
		int i = 0;
 		int temp;
		while (i < j) {
			temp = karty[i];
			karty[i] = karty[j];
			karty[j] = temp;
			i++;
			j--;
		}
		
		for (int i=0; i < num_kart; i++) {
			cout << karty[i] << " ";
		}
	}
	return 0;
}