/*
* Potyczki Algorytmiczne 2016, runda 1
* Zadanie: TAS
* Autor: Tomasz 'Xupicor' Wota <tomasz.wota@gmail.com> 2016-11-22
*/
#include <iostream>
#include <cmath>
#include <vector>
int main() {
std::ios::sync_with_stdio(false);
int n, t;
std::cin >> n >> t;
if (t % 2 == 0) { // nothing changes!
while (std::cin >> n) {
std::cout << n << ' ';
}
} else { // reverse the sequence!
std::vector<int> v;
v.reserve(std::pow(2, n));
while (std::cin >> n) {
v.push_back(n);
}
for (auto it = v.crbegin(); it != v.crend(); ++it) {
std::cout << *it << ' ';
}
}
}
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 | /* * Potyczki Algorytmiczne 2016, runda 1 * Zadanie: TAS * Autor: Tomasz 'Xupicor' Wota <tomasz.wota@gmail.com> 2016-11-22 */ #include <iostream> #include <cmath> #include <vector> int main() { std::ios::sync_with_stdio(false); int n, t; std::cin >> n >> t; if (t % 2 == 0) { // nothing changes! while (std::cin >> n) { std::cout << n << ' '; } } else { // reverse the sequence! std::vector<int> v; v.reserve(std::pow(2, n)); while (std::cin >> n) { v.push_back(n); } for (auto it = v.crbegin(); it != v.crend(); ++it) { std::cout << *it << ' '; } } } |
English