#include<iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); int t,n,a[100004],b[100004],c[100004],d[100004],amin=1000000002,bmax=0,cmin=1000000002,dmax=0,l=0; cin>>t; for(int j=0;j<t;j++) { amin=1000000002;bmax=0;cmin=1000000002;dmax=0;l=0; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]>>b[i]>>c[i]>>d[i]; if(a[i]<amin) amin=a[i]; if(c[i]<cmin) cmin=c[i]; if(b[i]>bmax) bmax=b[i]; if(d[i]>dmax) dmax=d[i]; } for(int i=0;i<n;i++) { if(a[i]==amin && b[i]==bmax && c[i]==cmin && d[i]==dmax) {l=1;i=n;} } if(l==0) cout<<"NIE"<<endl; else cout<<"TAK"<<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 | #include<iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); int t,n,a[100004],b[100004],c[100004],d[100004],amin=1000000002,bmax=0,cmin=1000000002,dmax=0,l=0; cin>>t; for(int j=0;j<t;j++) { amin=1000000002;bmax=0;cmin=1000000002;dmax=0;l=0; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]>>b[i]>>c[i]>>d[i]; if(a[i]<amin) amin=a[i]; if(c[i]<cmin) cmin=c[i]; if(b[i]>bmax) bmax=b[i]; if(d[i]>dmax) dmax=d[i]; } for(int i=0;i<n;i++) { if(a[i]==amin && b[i]==bmax && c[i]==cmin && d[i]==dmax) {l=1;i=n;} } if(l==0) cout<<"NIE"<<endl; else cout<<"TAK"<<endl; } return 0; } |