#include <bits/stdc++.h> using namespace std; #define ll long long int main(){ ios_base::sync_with_stdio(0);cin.tie(0); ll n; cin >> n; vector<ll> a(n + 5); vector<ll> out; bool nie = 0; for(int i = 1; i <= n; i++){ cin >> a[i]; if(i == 1) out.push_back(a[i]); if(i >= 2 && a[i] - a[i - 1] <= a[1]) out.push_back(a[i] - a[i - 1]); else if(i != 1) nie = 1; } if(nie) cout << "NIE"; else{ cout << "TAK\n"; cout << out.size() << '\n'; for(int it: out) cout << it << ' '; } 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 | #include <bits/stdc++.h> using namespace std; #define ll long long int main(){ ios_base::sync_with_stdio(0);cin.tie(0); ll n; cin >> n; vector<ll> a(n + 5); vector<ll> out; bool nie = 0; for(int i = 1; i <= n; i++){ cin >> a[i]; if(i == 1) out.push_back(a[i]); if(i >= 2 && a[i] - a[i - 1] <= a[1]) out.push_back(a[i] - a[i - 1]); else if(i != 1) nie = 1; } if(nie) cout << "NIE"; else{ cout << "TAK\n"; cout << out.size() << '\n'; for(int it: out) cout << it << ' '; } return 0; } |