#include <iostream> #include <vector> using namespace std; struct lustro { int a, b; int x, y; lustro(){}; lustro(int c, int d, int e, int f){a=c; b=d; x=e; y=f;}; void read(){cin>>a>>b>>x>>y;}; }; vector <lustro> L; int main() { ios::sync_with_stdio(0); int t; cin>>t; while(t--) { int n; cin>>n; L.resize(n); for(int i=0; i<n; i++) L[i].read(); lustro M=L[0]; bool ans=true; for(int i=1; i<n; i++) { if(M.x<=L[i].x && M.y>=L[i].y && M.a<=L[i].a && M.b>=L[i].b) continue; if(M.x>=L[i].x && M.y<=L[i].y && M.a>=L[i].a && M.b<=L[i].b) {M=L[i]; ans=true;} else ans=false; } if(ans) cout<<"TAK\n"; else cout<<"NIE\n"; } 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 | #include <iostream> #include <vector> using namespace std; struct lustro { int a, b; int x, y; lustro(){}; lustro(int c, int d, int e, int f){a=c; b=d; x=e; y=f;}; void read(){cin>>a>>b>>x>>y;}; }; vector <lustro> L; int main() { ios::sync_with_stdio(0); int t; cin>>t; while(t--) { int n; cin>>n; L.resize(n); for(int i=0; i<n; i++) L[i].read(); lustro M=L[0]; bool ans=true; for(int i=1; i<n; i++) { if(M.x<=L[i].x && M.y>=L[i].y && M.a<=L[i].a && M.b>=L[i].b) continue; if(M.x>=L[i].x && M.y<=L[i].y && M.a>=L[i].a && M.b<=L[i].b) {M=L[i]; ans=true;} else ans=false; } if(ans) cout<<"TAK\n"; else cout<<"NIE\n"; } return 0; } |