blob: 0dd8b5a4e92d2d39d9851a8e589cf3deead412ff (
plain) (
blame)
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
|
#include <stdlib.h>
#include <stdio.h>
int main()
{
int t, n, i;
long *a = malloc(10000 * sizeof(long)), b;
scanf("%d\n", &t);
while (t--) {
scanf("%d\n", &n);
for (i = 0; i < n; i++)
scanf("%ld", a + i);
for (i = 0; i < n; i++) {
scanf("%ld", &b);
a[i] = b - a[i];
}
for (n--; --n; a++) {
if (*a < 0) {
puts("NIE");
break;
}
if (*a) {
a[1] -= *a * 2;
a[2] -= *a * 3;
}
}
if (n)
continue;
if (*a || *++a)
puts("NIE");
else
puts("TAK");
}
return 0;
}
|