#include <iostream>
#include<cstdio>
using namespace std;
int t,i,j,a1,a2,q1,q2,w1,w2,e1,e2,n;
bool z;
int main()
{
ios_base::sync_with_stdio(0);
cin>>t;
for(i=0;i<t;i++,z=1){
cin>>n;
cin>>w1>>w2>>e1>>e2;
n--;
for(j=0;j<n;j++){
cin>>a1>>a2>>q1>>q2;
if(a1<=w1&&a2>=w2&&q1<=e1&&q2>=e2)
z=1;
else if(a1<w1||a2>w2||q1<e1||q2>e2)
z=0;
w1=min(w1,a1);
w2=max(w2,a2);
e1=min(e1,q1);
e2=max(e2,q2);
}
if(z)
cout<<"TAK"<<endl;
else
cout<<"NIE"<<endl;
}
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 | #include <iostream> #include<cstdio> using namespace std; int t,i,j,a1,a2,q1,q2,w1,w2,e1,e2,n; bool z; int main() { ios_base::sync_with_stdio(0); cin>>t; for(i=0;i<t;i++,z=1){ cin>>n; cin>>w1>>w2>>e1>>e2; n--; for(j=0;j<n;j++){ cin>>a1>>a2>>q1>>q2; if(a1<=w1&&a2>=w2&&q1<=e1&&q2>=e2) z=1; else if(a1<w1||a2>w2||q1<e1||q2>e2) z=0; w1=min(w1,a1); w2=max(w2,a2); e1=min(e1,q1); e2=max(e2,q2); } if(z) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } return 0; } |
English