#include <cstdio> #include <vector> using namespace std; int z, n; int w1, w2, h1, h2; int main(){ scanf("%d", &z); while(z--){ scanf("%d", &n); vector<int> M(4); vector<vector<int> > P(n, vector<int>(4)); for(int i=0; i<n; ++i) for(int j=0; j<4; ++j) scanf("%d", &P[i][j]); for(int i=0; i<4; ++i) M[i] = P[0][i]; for(int i=1; i<n; ++i){ M[0] = min(M[0], P[i][0]); M[1] = max(M[1], P[i][1]); M[2] = min(M[2], P[i][2]); M[3] = max(M[3], P[i][3]); } bool ok = false; for(int i=0; i<n; ++i) ok |= (M == P[i]); if (ok) printf("TAK\n"); else printf("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 | #include <cstdio> #include <vector> using namespace std; int z, n; int w1, w2, h1, h2; int main(){ scanf("%d", &z); while(z--){ scanf("%d", &n); vector<int> M(4); vector<vector<int> > P(n, vector<int>(4)); for(int i=0; i<n; ++i) for(int j=0; j<4; ++j) scanf("%d", &P[i][j]); for(int i=0; i<4; ++i) M[i] = P[0][i]; for(int i=1; i<n; ++i){ M[0] = min(M[0], P[i][0]); M[1] = max(M[1], P[i][1]); M[2] = min(M[2], P[i][2]); M[3] = max(M[3], P[i][3]); } bool ok = false; for(int i=0; i<n; ++i) ok |= (M == P[i]); if (ok) printf("TAK\n"); else printf("NIE\n"); } } |