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
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    long n, poz, sum;

    cin >> n;

    vector<long> stat, rank, sumy;
    vector<long>::iterator i;

    poz = 0; sum = 0;
    while (poz < n) {
        long s;
        cin >> s;
        stat.push_back(s);
        rank.push_back(s - sum);
        for (int c = 0; c < poz; c++) {
            sumy[c] += (s - sum);
            if (sumy[c] > stat[poz - c]) {
                cout << "NIE" << endl;
                //for (i = sumy.begin(); i != sumy.end(); ++i) {
                //    cout << (*i) << " ";
                //}
                //cout << endl;
                //for (i = rank.begin(); i != rank.end(); ++i) {
                //    cout << (*i) << " ";
                //}
                return 0;
            }
        }
        sumy.push_back(s-sum);
        sum = s;
        poz++;
    }
    cout << "TAK" << endl;
    //for (i = sumy.begin(); i != sumy.end(); ++i) {
    //    cout << (*i) << " ";
    //}
    //cout << endl;
    cout << n << endl;
    for (i = rank.begin(); i != rank.end(); ++i) {
        cout << (*i) << " ";
    }
    cout << endl;
    return 0;
}