//Komasz Tasperowicz #include <iostream> #include <cstdio> #include <vector> #define FI first #define SE second using namespace std; const int INF = 1e9+1; int main() { int t; scanf("%d", &t); for (int o=0; o<t; ++o) { int n; scanf("%d", &n); vector <pair <int, int> > w(n), h(n); int wmin=INF, wmax=0, hmin=INF, hmax=0; for (int i=0; i<n; ++i) { scanf("%d %d %d %d", &w[i].FI, &w[i].SE, &h[i].FI, &h[i].SE); wmin = min(wmin, w[i].FI); wmax = max(wmax, w[i].SE); hmin = min(hmin, h[i].FI); hmax = max(hmax, h[i].SE); } bool W = false; for (int i=0; i<n; ++i) { if (w[i].FI == wmin && w[i].SE == wmax && h[i].FI == hmin && h[i].SE == hmax) { W = true; break; } } printf(W ? "TAK\n" : "NIE\n"); } }
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 | //Komasz Tasperowicz #include <iostream> #include <cstdio> #include <vector> #define FI first #define SE second using namespace std; const int INF = 1e9+1; int main() { int t; scanf("%d", &t); for (int o=0; o<t; ++o) { int n; scanf("%d", &n); vector <pair <int, int> > w(n), h(n); int wmin=INF, wmax=0, hmin=INF, hmax=0; for (int i=0; i<n; ++i) { scanf("%d %d %d %d", &w[i].FI, &w[i].SE, &h[i].FI, &h[i].SE); wmin = min(wmin, w[i].FI); wmax = max(wmax, w[i].SE); hmin = min(hmin, h[i].FI); hmax = max(hmax, h[i].SE); } bool W = false; for (int i=0; i<n; ++i) { if (w[i].FI == wmin && w[i].SE == wmax && h[i].FI == hmin && h[i].SE == hmax) { W = true; break; } } printf(W ? "TAK\n" : "NIE\n"); } } |