#include<cstdio> using namespace std; int main(){ int t,n,w1,w2,h1,h2,tmp; int maxw2, maxh2, minw1, minh1; bool major; scanf("%d",&t); for(int i = 0; i < t; i++){ major = false; maxw2 = 0, maxh2 = 0, minw1 = 1000000000, minh1 = 1000000000; scanf("%d", &n); for(int j = 0; j < n; j++){ scanf("%d%d%d%d",&w1,&w2,&h1,&h2); if(w1 < minw1){ minw1 = w1; major = false; } if(h1 < minh1){ minh1 = h1; major = false; } if(w2 > maxw2){ maxw2 = w2; major = false; } if(h2 > maxh2){ maxh2 = h2; major = false; } if(h1 == minh1 && h2 == maxh2 && w1 == minw1 && w2 == maxw2) major = true; } major?printf("TAK\n"): 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 | #include<cstdio> using namespace std; int main(){ int t,n,w1,w2,h1,h2,tmp; int maxw2, maxh2, minw1, minh1; bool major; scanf("%d",&t); for(int i = 0; i < t; i++){ major = false; maxw2 = 0, maxh2 = 0, minw1 = 1000000000, minh1 = 1000000000; scanf("%d", &n); for(int j = 0; j < n; j++){ scanf("%d%d%d%d",&w1,&w2,&h1,&h2); if(w1 < minw1){ minw1 = w1; major = false; } if(h1 < minh1){ minh1 = h1; major = false; } if(w2 > maxw2){ maxw2 = w2; major = false; } if(h2 > maxh2){ maxh2 = h2; major = false; } if(h1 == minh1 && h2 == maxh2 && w1 == minw1 && w2 == maxw2) major = true; } major?printf("TAK\n"): printf("NIE\n"); } return 0; } |