#include <iostream> using namespace std; int main(){ int t; cin>>t; for(int i=0;i<t;i++){ bool a=true; int q=0; int n;cin>>n; int t1[4],t2[4]; for(int j=0;j<4;j++) cin>>t1[j]; for(int k=1;k<n;k++){ for(int j=0;j<4;j++) cin>>t2[j]; if(t1[0]>t2[0] && t1[1]<t2[1] && t1[2]>t2[2] && t1[3]<t2[3]) q=1; if(t1[0]>t2[0] || t1[1]<t2[1] || t1[2]>t2[2] || t1[3]<t2[3]) a=false; } if(q!=0) cout<<"TAK"<<endl; else { if((q==0) && (a==true)) 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 33 34 35 | #include <iostream> using namespace std; int main(){ int t; cin>>t; for(int i=0;i<t;i++){ bool a=true; int q=0; int n;cin>>n; int t1[4],t2[4]; for(int j=0;j<4;j++) cin>>t1[j]; for(int k=1;k<n;k++){ for(int j=0;j<4;j++) cin>>t2[j]; if(t1[0]>t2[0] && t1[1]<t2[1] && t1[2]>t2[2] && t1[3]<t2[3]) q=1; if(t1[0]>t2[0] || t1[1]<t2[1] || t1[2]>t2[2] || t1[3]<t2[3]) a=false; } if(q!=0) cout<<"TAK"<<endl; else { if((q==0) && (a==true)) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } } return 0; } |