#include <iostream> #include <vector> using namespace std; vector <long long> result; long long sum; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a; cin >> a; if (i > 0 && a - sum > result.back()) { cout << "NIE\n"; return 0; } result.push_back(a - sum); sum = a; } cout << "TAK\n"; cout << result.size() << "\n"; for (int i = 0; i < result.size(); i++) { cout << result[i] << " "; } cout << "\n"; }
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 | #include <iostream> #include <vector> using namespace std; vector <long long> result; long long sum; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a; cin >> a; if (i > 0 && a - sum > result.back()) { cout << "NIE\n"; return 0; } result.push_back(a - sum); sum = a; } cout << "TAK\n"; cout << result.size() << "\n"; for (int i = 0; i < result.size(); i++) { cout << result[i] << " "; } cout << "\n"; } |