#include<cstdio> #include<iostream> using namespace std; const int MAXX=100005; int testy, WMIN, WMAX, HMIN, HMAX, n, ok; int wmin[MAXX]; int wmax[MAXX]; int hmin[MAXX]; int hmax[MAXX]; int main() { ios_base::sync_with_stdio(0); cin >> testy; while(testy--) { cin >> n; cin >> wmin[1] >> wmax[1] >> hmin[1] >> hmax[1]; WMIN=wmin[1]; WMAX=wmax[1]; HMIN=hmin[1]; HMAX=hmax[1]; for(int i=2; i<=n; i++) { cin >> wmin[i] >> wmax[i] >> hmin[i] >> hmax[i]; WMIN=min(WMIN, wmin[i]); WMAX=max(WMAX, wmax[i]); HMIN=min(HMIN, hmin[i]); HMAX=max(HMAX, hmax[i]); } ok=0; for(int i=1; i<=n; i++) { if(wmin[i]==WMIN && wmax[i]==WMAX && hmin[i]==HMIN && hmax[i]==HMAX) ok=5; } if(ok==5) 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 37 38 39 40 41 42 | #include<cstdio> #include<iostream> using namespace std; const int MAXX=100005; int testy, WMIN, WMAX, HMIN, HMAX, n, ok; int wmin[MAXX]; int wmax[MAXX]; int hmin[MAXX]; int hmax[MAXX]; int main() { ios_base::sync_with_stdio(0); cin >> testy; while(testy--) { cin >> n; cin >> wmin[1] >> wmax[1] >> hmin[1] >> hmax[1]; WMIN=wmin[1]; WMAX=wmax[1]; HMIN=hmin[1]; HMAX=hmax[1]; for(int i=2; i<=n; i++) { cin >> wmin[i] >> wmax[i] >> hmin[i] >> hmax[i]; WMIN=min(WMIN, wmin[i]); WMAX=max(WMAX, wmax[i]); HMIN=min(HMIN, hmin[i]); HMAX=max(HMAX, hmax[i]); } ok=0; for(int i=1; i<=n; i++) { if(wmin[i]==WMIN && wmax[i]==WMAX && hmin[i]==HMIN && hmax[i]==HMAX) ok=5; } if(ok==5) cout << "TAK\n"; else cout << "NIE\n"; } return 0; } |