#include<bits/stdc++.h> using namespace std; #define st first #define nd second typedef long long ll; int32_t main(){ ios::sync_with_stdio(false); int n; cin >> n; vector<ll> tab(n+1); for(int i=1;i<=n;i++) cin >> tab[i]; for(int i=1;i<=n;i++) for(int j=i;j<=n;j++) if(tab[j] - tab[i] > tab[j-i]) n = -1; if(n == -1) cout<<"NIE\n"; else { cout<<"TAK\n"<<n<<"\n"; for(int i=1;i<=n;i++) cout<<tab[i]-tab[i-1]<<" "; } }
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<bits/stdc++.h> using namespace std; #define st first #define nd second typedef long long ll; int32_t main(){ ios::sync_with_stdio(false); int n; cin >> n; vector<ll> tab(n+1); for(int i=1;i<=n;i++) cin >> tab[i]; for(int i=1;i<=n;i++) for(int j=i;j<=n;j++) if(tab[j] - tab[i] > tab[j-i]) n = -1; if(n == -1) cout<<"NIE\n"; else { cout<<"TAK\n"<<n<<"\n"; for(int i=1;i<=n;i++) cout<<tab[i]-tab[i-1]<<" "; } } |