#include<cstdio> #include<algorithm> using namespace std; struct mirror { int minw; int maxw; int minh; int maxh; }; mirror S[100001]; mirror best; bool operator ==(mirror a, mirror b) { return a.minw==b.minw && a.maxw==b.maxw && a.minh==b.minh && a.maxh==b.maxh; } int main() { int z; scanf("%d", &z); while(z--) { int n; scanf("%d", &n); best.minh=best.minw=2000000001; best.maxh=best.maxw=0; for(int i=0; i<n; i++) { scanf("%d%d%d%d", &S[i].minw, &S[i].maxw, &S[i].minh, &S[i].maxh); best.minw=min(best.minw, S[i].minw); best.maxw=max(best.maxw, S[i].maxw); best.minh=min(best.minh, S[i].minh); best.maxh=max(best.maxh, S[i].maxh); } bool flag=false; for(int i=0; i<n; i++) if(best==S[i]) { flag=true; break; } if(flag) printf("TAK\n"); else printf("NIE\n"); } }
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 46 47 48 49 50 51 52 53 54 55 56 57 | #include<cstdio> #include<algorithm> using namespace std; struct mirror { int minw; int maxw; int minh; int maxh; }; mirror S[100001]; mirror best; bool operator ==(mirror a, mirror b) { return a.minw==b.minw && a.maxw==b.maxw && a.minh==b.minh && a.maxh==b.maxh; } int main() { int z; scanf("%d", &z); while(z--) { int n; scanf("%d", &n); best.minh=best.minw=2000000001; best.maxh=best.maxw=0; for(int i=0; i<n; i++) { scanf("%d%d%d%d", &S[i].minw, &S[i].maxw, &S[i].minh, &S[i].maxh); best.minw=min(best.minw, S[i].minw); best.maxw=max(best.maxw, S[i].maxw); best.minh=min(best.minh, S[i].minh); best.maxh=max(best.maxh, S[i].maxh); } bool flag=false; for(int i=0; i<n; i++) if(best==S[i]) { flag=true; break; } if(flag) printf("TAK\n"); else printf("NIE\n"); } } |