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
#include <bits/stdc++.h>
using namespace std;

const int N = 305;
const int K = 305;
const long long inf = 1e13;

int n;
long long ogr[N];
long long tab[K];
long long pref[K];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &ogr[i]);
	}
	for (int i = 1; i <= n; i++) {
		tab[i] = ogr[i] - ogr[i - 1];
		pref[i] = pref[i - 1] + tab[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j + i <= n; j++) {
			if (pref[j + i] - pref[j] > ogr[i]) {
				printf("NIE\n");
				return 0;
			}
		}
	}
	printf("TAK\n%d\n", n);
	for (int i = 1; i <= n; i++) {
		printf("%lld ", tab[i]);
	}
	printf("\n");
}