#include <iostream> using namespace std; int main(){ int t,n,m,wmin, wmax,hmin,hmax; bool b; cin>>t; while(t){ b=false; cin>>n; int w1[n],w2[n],h1[n],h2[n]; wmin=1000000001; wmax=0; hmin=1000000001; hmax=0; for(m=0; m<n; m++){ cin>>w1[m]>>w2[m]>>h1[m]>>h2[m]; if(w1[m]<wmin) {wmin=w1[m];} if(w2[m]>wmax) {wmax=w2[m]; } if(h1[m]<hmin) {hmin=h1[m];} if(h2[m]>hmax) {hmax=h2[m];} } m=0; //cout<<wmin<<" "<<wmax<<" "<<hmin<<" "<<hmax<<endl; while(m<n && !(w1[m]==wmin && w2[m]==wmax && h1[m]==hmin && h2[m]==hmax)) {/*cout<<w1[m]<<" "<<w2[m]<<" "<<h1[m]<<" "<<h2[m]<<endl;*/ m++;} if(m<n) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; t--; } 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 | #include <iostream> using namespace std; int main(){ int t,n,m,wmin, wmax,hmin,hmax; bool b; cin>>t; while(t){ b=false; cin>>n; int w1[n],w2[n],h1[n],h2[n]; wmin=1000000001; wmax=0; hmin=1000000001; hmax=0; for(m=0; m<n; m++){ cin>>w1[m]>>w2[m]>>h1[m]>>h2[m]; if(w1[m]<wmin) {wmin=w1[m];} if(w2[m]>wmax) {wmax=w2[m]; } if(h1[m]<hmin) {hmin=h1[m];} if(h2[m]>hmax) {hmax=h2[m];} } m=0; //cout<<wmin<<" "<<wmax<<" "<<hmin<<" "<<hmax<<endl; while(m<n && !(w1[m]==wmin && w2[m]==wmax && h1[m]==hmin && h2[m]==hmax)) {/*cout<<w1[m]<<" "<<w2[m]<<" "<<h1[m]<<" "<<h2[m]<<endl;*/ m++;} if(m<n) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; t--; } return 0; } |