#include <iostream> #include <vector> using namespace std; int main() { int n; int m; cin >> n >> m; vector<int> tab; int p[3][3]; int sum = 0; for (int i = 0; i < 1000000; i++) { tab.push_back(0); } for (int i = 0; i < n; i++) { cin >> p[i][0] >> p[i][1] >> p[i][2]; sum += p[i][2]; for (int j = p[i][0]; j < p[i][1]; j++) { tab[j]++; } } int count = 0; bool czy = false; for (int i = 0; i < 1000000; i++) { if (tab[i] > 0) { count++; } } if (count * m < sum) cout << "NIE"; else cout << "TAK"; return 0; }
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 | #include <iostream> #include <vector> using namespace std; int main() { int n; int m; cin >> n >> m; vector<int> tab; int p[3][3]; int sum = 0; for (int i = 0; i < 1000000; i++) { tab.push_back(0); } for (int i = 0; i < n; i++) { cin >> p[i][0] >> p[i][1] >> p[i][2]; sum += p[i][2]; for (int j = p[i][0]; j < p[i][1]; j++) { tab[j]++; } } int count = 0; bool czy = false; for (int i = 0; i < 1000000; i++) { if (tab[i] > 0) { count++; } } if (count * m < sum) cout << "NIE"; else cout << "TAK"; return 0; } |