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
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int n, tab[302], pref[302];
int main() {

    cin >> n;

    for (int i = 1; i <= n; i++) {
        cin >> pref[i]; 
    }

    for (int i = 1; i <= n; i++) {
        tab[i] = pref[i] - pref[i-1];
    }

    for (int i = 2; i <= n; i++) {
        for (int j = 1; j <= i-1; j++) {
            if (pref[j] + pref[i-j] < pref[i]) {
                cout << "NIE" << endl;
                return 0;
            }
        }
    }

    cout << "TAK" << endl;
    cout << n << endl;
    for (int i = 1; i <= n; i++) {
        cout << tab[i] << " ";
    }
    cout << endl;
    return 0;
}