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
/*
 * https://sio2.mimuw.edu.pl/c/pa-2020-1/p/ran/
 */

#include <iostream>
#include <vector>
#include <sstream>

using namespace std;

int main() {
    int n;

    std::cin >> n;

    vector<int> nums;

    for (int i = 0 ; i < n; ++i) {
        int a;
        std::cin >> a;
        nums.push_back(a);
    }

    for (size_t i = 0 ; i < nums.size() - 1; ++ i) {
        int jmp = i + 1;

        for (size_t j = 0 ; j + jmp < nums.size(); ++j) {

            if (nums[j+jmp] - nums[j] > nums[i]) {
                std::cout << "NIE" << std::endl;
                exit(0);
            }
        }

    }

    std::cout << "TAK" << std::endl;
    std::stringstream sstream;
    sstream << n << std::endl;
    int cur = nums[0];

    for (int i = 1 ; i < n ; ++ i ) {
        sstream << cur << " ";
        cur = nums[i] - nums[i-1];
    }

    sstream << cur << std::endl;
    std::cout << sstream.str() << std::endl;
}