#include<iostream> #include<cstdio> using namespace std; int z, n; const int INF = 1000000004; const int size = 100005; int A[size], B[size], C[size], D[size]; int main() { scanf("%d", &z); while(z--) { scanf("%d", &n); int minX = INF, minY = INF, maxX = -INF, maxY = -INF; for(int i = 0; i<n; i++) { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); A[i] = a; B[i] = b; C[i] = c, D[i] = d; minX = min(minX, a); maxX = max(maxX, b); minY = min(minY, c); maxY = max(maxY, d); } bool ok = false; for(int i = 0; i<n; i++) { if(A[i] == minX && B[i] == maxX && C[i] == minY && D[i] == maxY) { ok = true; break; } } if(ok) printf("TAK\n"); else printf("NIE\n"); } 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 | #include<iostream> #include<cstdio> using namespace std; int z, n; const int INF = 1000000004; const int size = 100005; int A[size], B[size], C[size], D[size]; int main() { scanf("%d", &z); while(z--) { scanf("%d", &n); int minX = INF, minY = INF, maxX = -INF, maxY = -INF; for(int i = 0; i<n; i++) { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); A[i] = a; B[i] = b; C[i] = c, D[i] = d; minX = min(minX, a); maxX = max(maxX, b); minY = min(minY, c); maxY = max(maxY, d); } bool ok = false; for(int i = 0; i<n; i++) { if(A[i] == minX && B[i] == maxX && C[i] == minY && D[i] == maxY) { ok = true; break; } } if(ok) printf("TAK\n"); else printf("NIE\n"); } return 0; } |