#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
const int INF = 1000000001;
int main(){
ios_base::sync_with_stdio(0);
int t;cin>>t;
for(int k=0;k<t;++k){
int n;cin>>n;
int wmin=INF,wmax=0,hmin=INF,hmax=0;
bool odp=false;
for(int l=0;l<n;++l){
int w1,w2,h1,h2;cin>>w1>>w2>>h1>>h2;
if(w1<wmin){
wmin=w1;
odp=false;
}
if(w2>wmax){
wmax=w2;
odp=false;
}
if(h1<hmin){
hmin=h1;
odp=false;
}
if(h2>hmax){
hmax=h2;
odp=false;
}
if(w1==wmin && w2==wmax && h1==hmin && h2==hmax) odp=true;
}
if(odp) 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 36 37 38 39 40 | #include <cstdio> #include <algorithm> #include <iostream> using namespace std; const int INF = 1000000001; int main(){ ios_base::sync_with_stdio(0); int t;cin>>t; for(int k=0;k<t;++k){ int n;cin>>n; int wmin=INF,wmax=0,hmin=INF,hmax=0; bool odp=false; for(int l=0;l<n;++l){ int w1,w2,h1,h2;cin>>w1>>w2>>h1>>h2; if(w1<wmin){ wmin=w1; odp=false; } if(w2>wmax){ wmax=w2; odp=false; } if(h1<hmin){ hmin=h1; odp=false; } if(h2>hmax){ hmax=h2; odp=false; } if(w1==wmin && w2==wmax && h1==hmin && h2==hmax) odp=true; } if(odp) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } return 0; } |
English