// ETI07E5v2.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <set>
#include <stdio.h>
#include <iterator>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define MAX 50000
bool mniejsze( int PierwszyFoo, int DrugiFoo )
{
return PierwszyFoo < DrugiFoo;
}
int main()
{
ios_base::sync_with_stdio(0);
long long int n = 0;
cin>>n;
long long int t = 0;
cin>>t;
long long int cardsNumber = pow(2,n);
long long int *cards = new long long int[cardsNumber];
for (int i = 0; i < cardsNumber; i++)
{
cin>>cards[i];
}
for (int i = 0; i < t; i++)
{
}
for (int i = 0; i < cardsNumber; i++)
{
if(t%2 == 0)
cout<<cards[i]<<" ";
else
cout<<cards[cardsNumber - 1 - i]<<" ";
}
//cin>>n;
/*
//int *x = new int[n];
long long int *y = new long long int[n];
long long int yLength = 0;
long long int min = 0;
long long int max = 0;
bool first = true;
vector<long long int> xVec;
for (long long int i = 0; i < n; i++)
{
long long int help = 0;
cin>>help;
//cin>>x[i];
xVec.push_back(help);
cin>>y[i];
yLength += abs(y[i]);
}
sort(xVec.begin(), xVec.end());
//for (vector<int>::size_type i = 0; i != xVec.size(); ++i)
// cout << xVec[i] << " ";
long long int a = 0;
long long int distance = 0;
if(n%2 == 1)
{
a = xVec[n/2];
distance = 0;
for (long long int j = 0; j < n; j++)
{
distance += abs(xVec[j]-a);
}
}
else
{
a = xVec[n/2-1];
//cout<<n/2-1;
//cout<<a<<endl;
distance = 0;
for (long long int j = 0; j < n; j++)
{
distance += abs(xVec[j]-a);
}
}
cout<<a<<" "<<yLength+distance;
//cin>>n;
*/
return 0;
}
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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | // ETI07E5v2.cpp : Defines the entry point for the console application. // #include <iostream> #include <set> #include <stdio.h> #include <iterator> #include <vector> #include <iostream> #include <algorithm> using namespace std; #define MAX 50000 bool mniejsze( int PierwszyFoo, int DrugiFoo ) { return PierwszyFoo < DrugiFoo; } int main() { ios_base::sync_with_stdio(0); long long int n = 0; cin>>n; long long int t = 0; cin>>t; long long int cardsNumber = pow(2,n); long long int *cards = new long long int[cardsNumber]; for (int i = 0; i < cardsNumber; i++) { cin>>cards[i]; } for (int i = 0; i < t; i++) { } for (int i = 0; i < cardsNumber; i++) { if(t%2 == 0) cout<<cards[i]<<" "; else cout<<cards[cardsNumber - 1 - i]<<" "; } //cin>>n; /* //int *x = new int[n]; long long int *y = new long long int[n]; long long int yLength = 0; long long int min = 0; long long int max = 0; bool first = true; vector<long long int> xVec; for (long long int i = 0; i < n; i++) { long long int help = 0; cin>>help; //cin>>x[i]; xVec.push_back(help); cin>>y[i]; yLength += abs(y[i]); } sort(xVec.begin(), xVec.end()); //for (vector<int>::size_type i = 0; i != xVec.size(); ++i) // cout << xVec[i] << " "; long long int a = 0; long long int distance = 0; if(n%2 == 1) { a = xVec[n/2]; distance = 0; for (long long int j = 0; j < n; j++) { distance += abs(xVec[j]-a); } } else { a = xVec[n/2-1]; //cout<<n/2-1; //cout<<a<<endl; distance = 0; for (long long int j = 0; j < n; j++) { distance += abs(xVec[j]-a); } } cout<<a<<" "<<yLength+distance; //cin>>n; */ return 0; } |
English