//Runda 1, "Lustra", Dawid Dworak, AGH #include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(0); long unsigned int t,n; bool r; cin >> t; for(long unsigned int i=0; i<t;i++){ cin >> n; long unsigned int wmin=2147483647,wmax=0,hmin=2147483647,hmax=0,w1,w2,w3,w4,f1=0,f2=0,f3=0,f4=0; for(long unsigned int k=0; k<n;k++){ r=1; cin >> w1 >> w2 >> w3 >> w4; if(w1<=wmin)wmin=w1; else r=0; if(w2>=wmax)wmax=w2; else r=0; if(w3<=hmin)hmin=w3; else r=0; if(w4>=hmax)hmax=w4; else r=0; if(r){ f1=w1; f2=w2; f3=w3; f4=w4; } } if(f1==wmin && f2==wmax && f3==hmin && f4==hmax)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 | //Runda 1, "Lustra", Dawid Dworak, AGH #include <iostream> using namespace std; int main(){ ios_base::sync_with_stdio(0); long unsigned int t,n; bool r; cin >> t; for(long unsigned int i=0; i<t;i++){ cin >> n; long unsigned int wmin=2147483647,wmax=0,hmin=2147483647,hmax=0,w1,w2,w3,w4,f1=0,f2=0,f3=0,f4=0; for(long unsigned int k=0; k<n;k++){ r=1; cin >> w1 >> w2 >> w3 >> w4; if(w1<=wmin)wmin=w1; else r=0; if(w2>=wmax)wmax=w2; else r=0; if(w3<=hmin)hmin=w3; else r=0; if(w4>=hmax)hmax=w4; else r=0; if(r){ f1=w1; f2=w2; f3=w3; f4=w4; } } if(f1==wmin && f2==wmax && f3==hmin && f4==hmax)cout << "TAK\n"; else cout << "NIE\n"; } return 0; } |