#include<bits/stdc++.h> #define fi first #define se second using namespace std; int a[310]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,i,j; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++) { for(j=i+1;j<=n;j++) { if(a[j]-a[i]>a[j-i]) { cout<<"NIE\n"; return 0; } } } cout<<"TAK\n"<<n<<"\n"; for(i=1;i<=n;i++) cout<<a[i]-a[i-1]<<" "; cout<<"\n"; 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 31 | #include<bits/stdc++.h> #define fi first #define se second using namespace std; int a[310]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,i,j; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; for(i=1;i<=n;i++) { for(j=i+1;j<=n;j++) { if(a[j]-a[i]>a[j-i]) { cout<<"NIE\n"; return 0; } } } cout<<"TAK\n"<<n<<"\n"; for(i=1;i<=n;i++) cout<<a[i]-a[i-1]<<" "; cout<<"\n"; return 0; } |