#include <cstdio> using namespace std; int main() { int t; scanf("%d", &t); for (int i = 0; i < t; i++) { int n; scanf("%d", &n); int wd, wu, hd, hu; scanf("%d %d %d %d", &wd, &wu, &hd, &hu); int wmin = wd, wmax = wu, hmin = hd, hmax = hu; bool result = true; for (int j = 1; j < n; j++) { scanf("%d %d %d %d", &wd, &wu, &hd, &hu); bool change = false; if (wd < wmin) { wmin = wd; change = true; } if (wu > wmax) { wmax = wu; change = true; } if (hd < hmin) { hmin = hd; change = true; } if (hu > hmax) { hmax = hu; change = true; } if (!result || change) { result = (wd == wmin && wu == wmax && hd == hmin && hu == hmax); } } puts((result ? "TAK" : "NIE")); } 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 | #include <cstdio> using namespace std; int main() { int t; scanf("%d", &t); for (int i = 0; i < t; i++) { int n; scanf("%d", &n); int wd, wu, hd, hu; scanf("%d %d %d %d", &wd, &wu, &hd, &hu); int wmin = wd, wmax = wu, hmin = hd, hmax = hu; bool result = true; for (int j = 1; j < n; j++) { scanf("%d %d %d %d", &wd, &wu, &hd, &hu); bool change = false; if (wd < wmin) { wmin = wd; change = true; } if (wu > wmax) { wmax = wu; change = true; } if (hd < hmin) { hmin = hd; change = true; } if (hu > hmax) { hmax = hu; change = true; } if (!result || change) { result = (wd == wmin && wu == wmax && hd == hmin && hu == hmax); } } puts((result ? "TAK" : "NIE")); } return 0; } |