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
34
35
36
37
38
39
40
41
#include<bits/stdc++.h>
using namespace std;

int main()
{   
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    
    vector<int> a;
    a.push_back(0);
    for (int i = 1; i <= n; ++i) {
        int x;
        cin >> x;
        a.push_back(x);
    }
    
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j < i; ++j) {
            if (a[i] - a[i-j] > a[j]) {
                cout << "NIE" << '\n';
                exit(0);
            }
        }
    }
    
    vector<long long> ans;
    for (int i = 1; i <= n; ++i) {
        ans.push_back(a[i] - a[i-1]);
    }
    
    cout << "TAK" << '\n';
    cout << ans.size() << '\n';
    for (int i = 0; i < (int)ans.size(); ++i) {
        if (i > 0) { cout << ' '; }
        cout << ans[i];
    }
    
    cout << '\n';
}