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
49
50
51
#include <algorithm> 
#include <string.h>
#include <vector>

#include <iostream>
#include <string.h>
#include <ctime>

#include <iterator>

int main()
{
	// just for fun;)

	srand(time(0));

	int n, m;
	std::cin >> n >> m;

	//n - tasks
	//m -  processors
	int p[100], k[100], c[100];
	
	for (int i = 0;i < n;i++)
		std::cin >> p[i] >> k[i] >> c[i];

	int minTime = *std::min_element(p, p + n);
	int maxTime = *std::max_element(k, k + n);
	
	int sum = 0;
	for (int i = 0;i < n;i++)
		sum += c[i];

	int area = (maxTime - minTime)*m;

	if (sum > area)
	{
		std::cout << "NIE";
		return 0;
	}

	if (n < m)
	{
		std::cout << "TAK";
		return 0;
	}

	std::cout << ((rand() % 2 == 0) ? "NIE" : "TAK");

    return 0;
}