#include <iostream> /* ZADANIE: lus POTYCZKI ALGORYTMICZNE 2014 ANNA MALIZJUSZ */ using namespace std; int main () { ios_base::sync_with_stdio(0); int t; cin>>t; for (int j=0; j<t; j++) { int n, h1[100000], w1[100000], h2[100000], w2[100000],i,a; int H=0, h=1000000000, W=0, w=1000000000; bool x=false; cin>>n; for (i=0;i<n;i++) { cin>>a; w1[i]=a; if (a<w) w=a; cin>>a; w2[i]=a; if (a>W) W=a; cin>>a; h1[i]=a; if (a<h) h=a; cin>>a; h2[i]=a; if (a>H) H=a; } for (i=0;i<n;i++) { if (w1[i]==w) { if (w2[i]==W) { if (h1[i]==h) { if (h2[i]==H) { x=true; break; } else continue; } else continue; } else continue; } else continue; } if (x==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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #include <iostream> /* ZADANIE: lus POTYCZKI ALGORYTMICZNE 2014 ANNA MALIZJUSZ */ using namespace std; int main () { ios_base::sync_with_stdio(0); int t; cin>>t; for (int j=0; j<t; j++) { int n, h1[100000], w1[100000], h2[100000], w2[100000],i,a; int H=0, h=1000000000, W=0, w=1000000000; bool x=false; cin>>n; for (i=0;i<n;i++) { cin>>a; w1[i]=a; if (a<w) w=a; cin>>a; w2[i]=a; if (a>W) W=a; cin>>a; h1[i]=a; if (a<h) h=a; cin>>a; h2[i]=a; if (a>H) H=a; } for (i=0;i<n;i++) { if (w1[i]==w) { if (w2[i]==W) { if (h1[i]==h) { if (h2[i]==H) { x=true; break; } else continue; } else continue; } else continue; } else continue; } if (x==true) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } return 0; } |