#include <stdio.h> struct dane{ unsigned long int w1,w2,h1,h2; }; int main() { unsigned short int t=0; scanf("%hu", &t); unsigned short int i; for(i = 0;i<t;i++) { unsigned long int n,k,primary=0; scanf("%lu", &n); struct dane firm[n]; unsigned long int i1; for(i1 = 0;i1<n;i1++) { scanf("%lu %lu %lu %lu", &firm[i1].w1, &firm[i1].w2, &firm[i1].h1, &firm[i1].h2); if(primary<((firm[i1].w2-(firm[i1].w1-1))*(firm[i1].h2-(firm[i1].h1-1)))) { k=i1; primary=((firm[i1].w2-(firm[i1].w1-1))*(firm[i1].h2-(firm[i1].h1-1))); } } for(i1 = 0;i1<n;i1++) { if(i1!=k) { if( (firm[i1].w1<firm[k].w1) || (firm[i1].w2>firm[k].w2) || (firm[i1].h1<firm[k].h1) || (firm[i1].h2>firm[k].h2) ) { printf("NIE\n"); break; } } if(i1==n-1) printf("TAK\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 | #include <stdio.h> struct dane{ unsigned long int w1,w2,h1,h2; }; int main() { unsigned short int t=0; scanf("%hu", &t); unsigned short int i; for(i = 0;i<t;i++) { unsigned long int n,k,primary=0; scanf("%lu", &n); struct dane firm[n]; unsigned long int i1; for(i1 = 0;i1<n;i1++) { scanf("%lu %lu %lu %lu", &firm[i1].w1, &firm[i1].w2, &firm[i1].h1, &firm[i1].h2); if(primary<((firm[i1].w2-(firm[i1].w1-1))*(firm[i1].h2-(firm[i1].h1-1)))) { k=i1; primary=((firm[i1].w2-(firm[i1].w1-1))*(firm[i1].h2-(firm[i1].h1-1))); } } for(i1 = 0;i1<n;i1++) { if(i1!=k) { if( (firm[i1].w1<firm[k].w1) || (firm[i1].w2>firm[k].w2) || (firm[i1].h1<firm[k].h1) || (firm[i1].h2>firm[k].h2) ) { printf("NIE\n"); break; } } if(i1==n-1) printf("TAK\n"); } } return 0; } |