#ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-result" #else #define _CRT_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_WARNINGS #endif #include <cstdlib> #include <ctime> #include <cstdio> #include <cmath> #include <cstring> #include <vector> #include <queue> #include <map> #include <set> #include <list> #include <algorithm> #include <string> #include <iostream> #define FOR(x,y,z) for (int x=(y); x<=(z); ++x) #define FORD(x,y,z) for(int x=(y); x>=(z); --x) #define REP(x,y) for (int x=0; x<(y); ++x) #if defined(__GNUC__) && __cplusplus < 201103L #define FOREACH(y,x) for (typeof((x).begin()) y = (x).begin(); y != (x).end(); ++y) #else #define FOREACH(y,x) for (auto y = (x).begin(); y != (x).end(); ++y) #endif #define ALL(x) (x).begin(),(x).end() #define SIZE(x) ((int)(x).size()) using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<int> VI; typedef vector<VI> VVI; typedef pair<int,int> PII; typedef vector<PII> VPII; const int INF = 1000000001; int main(int argc, char** argv) { int tc; scanf("%d", &tc); REP(tccc,tc) { int n; scanf("%d", &n); VI w1(n), w2(n), h1(n), h2(n); REP(i,n) scanf("%d%d%d%d", &w1[i], &w2[i], &h1[i], &h2[i]); int minw = *min_element(ALL(w1)); int maxw = *max_element(ALL(w2)); int minh = *min_element(ALL(h1)); int maxh = *max_element(ALL(h2)); bool ok = false; REP(i,n) { if (w1[i] == minw && w2[i] == maxw && h1[i] == minh && h2[i] == maxh) { ok = true; break; } } if (ok) printf("TAK\n"); else printf("NIE\n"); } #ifdef _DEBUG system("pause"); #endif 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 | #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-result" #else #define _CRT_SECURE_NO_WARNINGS #define _SCL_SECURE_NO_WARNINGS #endif #include <cstdlib> #include <ctime> #include <cstdio> #include <cmath> #include <cstring> #include <vector> #include <queue> #include <map> #include <set> #include <list> #include <algorithm> #include <string> #include <iostream> #define FOR(x,y,z) for (int x=(y); x<=(z); ++x) #define FORD(x,y,z) for(int x=(y); x>=(z); --x) #define REP(x,y) for (int x=0; x<(y); ++x) #if defined(__GNUC__) && __cplusplus < 201103L #define FOREACH(y,x) for (typeof((x).begin()) y = (x).begin(); y != (x).end(); ++y) #else #define FOREACH(y,x) for (auto y = (x).begin(); y != (x).end(); ++y) #endif #define ALL(x) (x).begin(),(x).end() #define SIZE(x) ((int)(x).size()) using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef vector<int> VI; typedef vector<VI> VVI; typedef pair<int,int> PII; typedef vector<PII> VPII; const int INF = 1000000001; int main(int argc, char** argv) { int tc; scanf("%d", &tc); REP(tccc,tc) { int n; scanf("%d", &n); VI w1(n), w2(n), h1(n), h2(n); REP(i,n) scanf("%d%d%d%d", &w1[i], &w2[i], &h1[i], &h2[i]); int minw = *min_element(ALL(w1)); int maxw = *max_element(ALL(w2)); int minh = *min_element(ALL(h1)); int maxh = *max_element(ALL(h2)); bool ok = false; REP(i,n) { if (w1[i] == minw && w2[i] == maxw && h1[i] == minh && h2[i] == maxh) { ok = true; break; } } if (ok) printf("TAK\n"); else printf("NIE\n"); } #ifdef _DEBUG system("pause"); #endif return 0; } |