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
#include <iostream>
#include <algorithm>

int main()
{
    int amount;
    std::cin >> amount;

    
    int old = 0;
    int* list = new int[amount];
    int* example = new int[amount];

    for (int i = 0; i < amount; i++) {
        int l;
        std::cin >> l;
        list[i] = l;
        example[i] = l - old;
        old = l;
    }
    bool wo = true;
    for(int ex = 0; ex < amount; ex++){
        int max = -100000000;
        for (int i = 0; i < amount - ex; i++) {
            int sum = 0;
            for (int c = 0; c < ex + 1; c++) {
                sum += example[i + c];
            }
            max = std::max(max, sum);
        }
        
        if (list[ex] != max) {
            wo = false;
            break;
        }
    }
    
    std::cout << (wo ? "TAK" : "NIE") << std::endl;
    if (wo) {
        std::cout << amount << std::endl;
        for (int i = 0; i < amount; i++) {
            std::cout << example[i] << " ";
        }
        std::cout << "\n";
    }
    
    return 0;
}