#include<iostream> using namespace std; const int N = 100000; typedef pair <int, int> PII; PII L[N], R[N]; int main() { ios_base::sync_with_stdio(0); int t; cin >> t; while (t--) { int n; cin >> n; int min1, max1, min2, max2; min1 = max1 = min2 = max2 = 0; for (int i = 0; i < n; i++) { cin >> L[i].first >> L[i].second >> R[i].first >> R[i].second; if (L[i].first < L[min1].first) min1 = i; if (L[i].second > L[max1].second) max1 = i; if (R[i].first < R[min2].first) min2 = i; if (R[i].second > R[max2].second) max2 = i; } bool okay = true; if (!(L[min1] == L[max1])) okay = false; if (!(R[min2] ==R[max2])) okay = false; if (!(L[min2] == L[min1])) okay = false; if (okay) cout << "TAK\n"; else cout << "NIE\n"; } // system("pause"); 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 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include<iostream> using namespace std; const int N = 100000; typedef pair <int, int> PII; PII L[N], R[N]; int main() { ios_base::sync_with_stdio(0); int t; cin >> t; while (t--) { int n; cin >> n; int min1, max1, min2, max2; min1 = max1 = min2 = max2 = 0; for (int i = 0; i < n; i++) { cin >> L[i].first >> L[i].second >> R[i].first >> R[i].second; if (L[i].first < L[min1].first) min1 = i; if (L[i].second > L[max1].second) max1 = i; if (R[i].first < R[min2].first) min2 = i; if (R[i].second > R[max2].second) max2 = i; } bool okay = true; if (!(L[min1] == L[max1])) okay = false; if (!(R[min2] ==R[max2])) okay = false; if (!(L[min2] == L[min1])) okay = false; if (okay) cout << "TAK\n"; else cout << "NIE\n"; } // system("pause"); return 0; } |