#include <cstdio> #define INF 2000000000 #define MAXN 100000 int min(int a, int b) { if(a < b) return a; return b; } int max(int a, int b) { if(a > b) return a; return b; } int main() { int t; scanf("%d", &t); for(int h = 0; h < t; h++) { int n; scanf("%d", &n); int w1[MAXN], w2[MAXN], h1[MAXN], h2[MAXN]; int wmin = INF, wmax = 0, hmin = INF, hmax = 0; for(int i = 0; i < n; i++) { scanf("%d%d%d%d", &w1[i], &w2[i], &h1[i], &h2[i]); wmin = min(wmin, w1[i]); wmax = max(wmax, w2[i]); hmin = min(hmin, h1[i]); hmax = max(hmax, h2[i]); } bool b = false; for(int i = 0; i < n; i++) if(w1[i] == wmin && w2[i] == wmax && h1[i] == hmin && h2[i] == hmax) { b = true; break; } if(b) 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 36 37 38 39 40 41 42 43 44 45 | #include <cstdio> #define INF 2000000000 #define MAXN 100000 int min(int a, int b) { if(a < b) return a; return b; } int max(int a, int b) { if(a > b) return a; return b; } int main() { int t; scanf("%d", &t); for(int h = 0; h < t; h++) { int n; scanf("%d", &n); int w1[MAXN], w2[MAXN], h1[MAXN], h2[MAXN]; int wmin = INF, wmax = 0, hmin = INF, hmax = 0; for(int i = 0; i < n; i++) { scanf("%d%d%d%d", &w1[i], &w2[i], &h1[i], &h2[i]); wmin = min(wmin, w1[i]); wmax = max(wmax, w2[i]); hmin = min(hmin, h1[i]); hmax = max(hmax, h2[i]); } bool b = false; for(int i = 0; i < n; i++) if(w1[i] == wmin && w2[i] == wmax && h1[i] == hmin && h2[i] == hmax) { b = true; break; } if(b) printf("TAK\n"); else printf("NIE\n"); } return 0; } |