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>
using namespace std;
#define magiczne ios_base::sync_with_stdio(0);
#define linijki cin.tie(0);
int n, in[307], tab[307];
int maxInterval (int length)
{
    int res = -INT_MAX;
    for (int i = 0; i + length <= n; ++i)
        res = max(res, in[i + length] - in[i]);
    //cout << res << ' ';
    return res;
}
int main()
{
    magiczne linijki
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> in[i];
        tab[i] = in[i] - in[i - 1];
    }
    for (int i = 1; i <= n; ++i)
        if (maxInterval(i) != in[i])
        {
            cout << "NIE";
            return 0;
        }
    cout << "TAK" << '\n' << n << '\n';
    for (int i = 1; i <= n; ++i)
        cout << tab[i] << ' ';
    return 0;
}