#define NDEBUG #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <algorithm> #include <queue> #include <string> #include <vector> using namespace std; #define TRACE(x) cerr<<"# "#x<<endl; #define DEBUG(x) cerr<<#x<<" = "<<(x)<<endl; typedef unsigned long long ULL; typedef long long LL; const int INF = 0x7FFFFFFF; int main() { unsigned t, n, w1, w2, h1, h2, wmin, wmax, hmin, hmax, w_min, w_max, h_min, h_max; scanf("%u", &t); for(auto tt=0; tt<t; ++tt) { scanf("%u", &n); scanf("%u %u %u %u", &wmin, &wmax, &hmin, &hmax); w_min = wmin; w_max = wmax; h_min = hmin; h_max = hmax; for(auto i=1; i<n ;++i) { scanf("%u %u %u %u", &w1, &w2, &h1, &h2); if((w1 < wmin) || (w2 > wmax) || (h1 < hmin) || (h2 > hmax)) { wmin = w1; wmax = w2; hmin = h1; hmax = h2; } if(w1 < w_min) w_min = w1; if(w2 > w_max) w_max = w2; if(h1 < h_min) h_min = h1; if(h2 > h_max) h_max = h2; } printf(((w_min==wmin) && (w_max==wmax) && (h_min==hmin) && (h_max==hmax)) ? "TAK\n" : "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 43 44 45 46 47 | #define NDEBUG #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <sstream> #include <algorithm> #include <queue> #include <string> #include <vector> using namespace std; #define TRACE(x) cerr<<"# "#x<<endl; #define DEBUG(x) cerr<<#x<<" = "<<(x)<<endl; typedef unsigned long long ULL; typedef long long LL; const int INF = 0x7FFFFFFF; int main() { unsigned t, n, w1, w2, h1, h2, wmin, wmax, hmin, hmax, w_min, w_max, h_min, h_max; scanf("%u", &t); for(auto tt=0; tt<t; ++tt) { scanf("%u", &n); scanf("%u %u %u %u", &wmin, &wmax, &hmin, &hmax); w_min = wmin; w_max = wmax; h_min = hmin; h_max = hmax; for(auto i=1; i<n ;++i) { scanf("%u %u %u %u", &w1, &w2, &h1, &h2); if((w1 < wmin) || (w2 > wmax) || (h1 < hmin) || (h2 > hmax)) { wmin = w1; wmax = w2; hmin = h1; hmax = h2; } if(w1 < w_min) w_min = w1; if(w2 > w_max) w_max = w2; if(h1 < h_min) h_min = h1; if(h2 > h_max) h_max = h2; } printf(((w_min==wmin) && (w_max==wmax) && (h_min==hmin) && (h_max==hmax)) ? "TAK\n" : "NIE\n"); } return 0; } |