#include <cstdio> const int MAX_N = 100000+44; int w1[MAX_N], w2[MAX_N], h1[MAX_N], h2[MAX_N]; int main() { int t; scanf("%d", &t); while(t-->0) { int n; scanf("%d", &n); int minw1=1000000000; int maxw2=0; int minh1=1000000000; int maxh2=0; for(int i=0;i<n;i++) { scanf("%d%d%d%d", &w1[i], &w2[i], &h1[i], &h2[i]); if(w1[i]<minw1) minw1=w1[i]; if(w2[i]>maxw2) maxw2=w2[i]; if(h1[i]<minh1) minh1=h1[i]; if(h2[i]>maxh2) maxh2=h2[i]; } bool result = false; for(int i=0;i<n;i++) { if(minw1==w1[i] && maxw2==w2[i] && minh1==h1[i] && maxh2==h2[i]) { result = true; break; } } printf("%s\n", result?"TAK":"NIE"); } }
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 <cstdio> const int MAX_N = 100000+44; int w1[MAX_N], w2[MAX_N], h1[MAX_N], h2[MAX_N]; int main() { int t; scanf("%d", &t); while(t-->0) { int n; scanf("%d", &n); int minw1=1000000000; int maxw2=0; int minh1=1000000000; int maxh2=0; for(int i=0;i<n;i++) { scanf("%d%d%d%d", &w1[i], &w2[i], &h1[i], &h2[i]); if(w1[i]<minw1) minw1=w1[i]; if(w2[i]>maxw2) maxw2=w2[i]; if(h1[i]<minh1) minh1=h1[i]; if(h2[i]>maxh2) maxh2=h2[i]; } bool result = false; for(int i=0;i<n;i++) { if(minw1==w1[i] && maxw2==w2[i] && minh1==h1[i] && maxh2==h2[i]) { result = true; break; } } printf("%s\n", result?"TAK":"NIE"); } } |