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
#include <iostream>
#include <stdio.h>
#define INF 1000000000000000000

using namespace std;

int n;
long long mn,sum;
long long dp[301];
bool r;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&dp[i]);
        mn=INF;
        for(int j=i-1;j>0;j--) mn=min(mn,dp[j]+dp[i-j]);
        if(mn<dp[i]) r=true;
    }

    if(r) printf("NIE\n");
    else
    {
        printf("TAK\n%d\n",n);
        for(int i=1;i<=n;i++){
            printf("%lld ",dp[i]-dp[i-1]);
        }
    }

    return 0;
}