#include <cstdio> #include <vector> using namespace std; class lus { public: int w1, w2, h1, h2; lus(int _w1, int _w2, int _h1, int _h2):w1(_w1), w2(_w2), h1(_h1), h2(_h2) {}; }; int z; int main() { scanf("%d", &z); for (int i = 0; i < z; i++) { int L; int w1, w2, h1, h2; int W1 = 1000000001, W2 = 0, H1 = 1000000001, H2 = 0; scanf("%d", &L); vector<lus> v; for (int l = 0; l < L; l++) { scanf("%d %d %d %d", &w1, &w2, &h1, &h2); W1 = W1 < w1 ? W1 : w1; W2 = W2 < w2 ? w2 : W2; H1 = H1 < h1 ? H1 : h1; H2 = H2 < h2 ? h2 : H2; v.push_back(lus(w1, w2, h1, h2)); } bool OK = false; for (int l = 0; l < L; l++) { if (v[l].w1 = W1 && v[l].w2 == W2 && v[l].h1 == H1 && v[l].h2 == H2) { OK = true; break; } } if (OK) printf ("TAK\n"); else printf ("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 | #include <cstdio> #include <vector> using namespace std; class lus { public: int w1, w2, h1, h2; lus(int _w1, int _w2, int _h1, int _h2):w1(_w1), w2(_w2), h1(_h1), h2(_h2) {}; }; int z; int main() { scanf("%d", &z); for (int i = 0; i < z; i++) { int L; int w1, w2, h1, h2; int W1 = 1000000001, W2 = 0, H1 = 1000000001, H2 = 0; scanf("%d", &L); vector<lus> v; for (int l = 0; l < L; l++) { scanf("%d %d %d %d", &w1, &w2, &h1, &h2); W1 = W1 < w1 ? W1 : w1; W2 = W2 < w2 ? w2 : W2; H1 = H1 < h1 ? H1 : h1; H2 = H2 < h2 ? h2 : H2; v.push_back(lus(w1, w2, h1, h2)); } bool OK = false; for (int l = 0; l < L; l++) { if (v[l].w1 = W1 && v[l].w2 == W2 && v[l].h1 == H1 && v[l].h2 == H2) { OK = true; break; } } if (OK) printf ("TAK\n"); else printf ("NIE\n"); } return 0; } |