#include <cstdio> #include <algorithm> #define s(x); scanf("%d",&x); using namespace std; const int INF = 1000000000; void solve(){ bool zapadka = false; int max1=0,max2=0,min1=INF,min2=INF; int ile; s(ile); for(int i = 0; i < ile; i++){ int a,b,c,d; s(a); s(b); s(c); s(d); if(a<=min1&&b>=max1&&c<=min2&&d>=max2) zapadka = true; else if(a<min1||b>max1||c<min2||d>max2) zapadka = false; min1 = min(min1,a); min2 = min(min2,c); max1 = max(max1,b); max2 = max(max2,d); } if(zapadka) printf("TAK\n"); else printf("NIE\n"); return; } int main(){ int ile; s(ile); while(ile--) solve(); 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 | #include <cstdio> #include <algorithm> #define s(x); scanf("%d",&x); using namespace std; const int INF = 1000000000; void solve(){ bool zapadka = false; int max1=0,max2=0,min1=INF,min2=INF; int ile; s(ile); for(int i = 0; i < ile; i++){ int a,b,c,d; s(a); s(b); s(c); s(d); if(a<=min1&&b>=max1&&c<=min2&&d>=max2) zapadka = true; else if(a<min1||b>max1||c<min2||d>max2) zapadka = false; min1 = min(min1,a); min2 = min(min2,c); max1 = max(max1,b); max2 = max(max2,d); } if(zapadka) printf("TAK\n"); else printf("NIE\n"); return; } int main(){ int ile; s(ile); while(ile--) solve(); return 0; } |