#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int t;
scanf("%d", &t);
while(t--){
int n;
scanf("%d", &n);
int t[4]={1000000000,0,1000000000,0};
bool e=false;
while(n--){
int a,b,c,d;
scanf("%d%d%d%d", &a,&b,&c,&d);
if(a<=t[0]&&b>=t[1]&&c<=t[2]&&d>=t[3]){
t[0]=a;
t[1]=b;
t[2]=c;
t[3]=d;
e=true;
}
if(a<t[0]||b>t[1]||c<t[2]||d>t[3]){
e=false;
}
t[0]=min(t[0],a);
t[1]=max(t[1],b);
t[2]=min(t[2],c);
t[3]=max(t[3],d);
}
if(e)
printf("TAK\n");
else{
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 | #include <cstdio> #include <algorithm> using namespace std; int main() { int t; scanf("%d", &t); while(t--){ int n; scanf("%d", &n); int t[4]={1000000000,0,1000000000,0}; bool e=false; while(n--){ int a,b,c,d; scanf("%d%d%d%d", &a,&b,&c,&d); if(a<=t[0]&&b>=t[1]&&c<=t[2]&&d>=t[3]){ t[0]=a; t[1]=b; t[2]=c; t[3]=d; e=true; } if(a<t[0]||b>t[1]||c<t[2]||d>t[3]){ e=false; } t[0]=min(t[0],a); t[1]=max(t[1],b); t[2]=min(t[2],c); t[3]=max(t[3],d); } if(e) printf("TAK\n"); else{ printf("NIE\n"); } } return 0; } |
English