#include <iostream> int main(void) { int n, t; std::cin >> n >> t; if ( t % 2 ) { int* values = new int [ 1 << n ]; for ( int i = 0; i < ( 1 << n ); ++i ) std::cin >> values[ i ]; for ( int i = ( 1 << n ); i > 0; i ) std::cout << values[ --i ] << " "; } else { int in; for ( int i = 0; i < ( 1 << n ); ++i ) { if ( i ) std::cout << in << " "; std::cin >> in; } } 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 | #include <iostream> int main(void) { int n, t; std::cin >> n >> t; if ( t % 2 ) { int* values = new int [ 1 << n ]; for ( int i = 0; i < ( 1 << n ); ++i ) std::cin >> values[ i ]; for ( int i = ( 1 << n ); i > 0; i ) std::cout << values[ --i ] << " "; } else { int in; for ( int i = 0; i < ( 1 << n ); ++i ) { if ( i ) std::cout << in << " "; std::cin >> in; } } return 0; }; |