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 <cstdio>
#include <cstddef>
#include <cstdlib>
#include <queue>
#include <vector>
#include <iostream>

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    int n;
    std::cin >> n;
    double lastProp;
    int *a = new int[n];
    std::cin >> a[0];
    // std::cerr << a[0] << "\n";
    lastProp=a[0];
    for(int i=1;i<n;i++){
        int tmp;
        std::cin >> tmp;
        // std::cerr << tmp << "\n";
        double tmp2 = (double)tmp/(double)(i+1);
        if(lastProp > tmp2){
            lastProp = tmp2;
        }else{
            std::cout << "NIE\n";
            return 0;
        }
        a[i]=tmp;
    }
    int T = (n*(n+1))/2+n-1;
    std::cout << "TAK\n";
    std::cout << T << "\n";
    for(int i=0;i<n;i++){
        int sign = (a[i]<0?-1:1);
        int b = a[i]/(i+1);
        // std::cerr << (1+i-(a[i]%(i+1))) << " ";
        for(int j=0;j<i+1;j++){
            std::cout << b + (j<(a[i]*sign)%(i+1)?sign:0) << " ";
        }
        // std::cout << b+(a[i]%(i+1)) << " ";
        if(i+1 != n){
            std::cout << "-100000000000 ";
        }
    }
}