/* * dawid.sieradzki@gmail.com */ #include <cstdio> using namespace std; int t, n; int w1, w2, h1, h2; int W1, W2, H1, H2; int main(int argc, char *argv[]) { scanf("%i", &t); while (t--) { scanf("%i", &n); scanf("%i%i%i%i", &W1, &W2, &H1, &H2); bool ret = true; for (int c = 1; c < n; c++) { scanf("%i%i%i%i", &w1, &w2, &h1, &h2); if (w1 <= W1 && w2 >= W2 && h1 <= H1 && h2 >= H2) { W1 = w1; W2 = w2; H1 = h1; H2 = h2; } else { ret = ret && (w1 >= W1 && w2 <= W2 && h1 >= H1 && h2 <= H2); } } printf(ret ? "TAK\n" : "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 | /* * dawid.sieradzki@gmail.com */ #include <cstdio> using namespace std; int t, n; int w1, w2, h1, h2; int W1, W2, H1, H2; int main(int argc, char *argv[]) { scanf("%i", &t); while (t--) { scanf("%i", &n); scanf("%i%i%i%i", &W1, &W2, &H1, &H2); bool ret = true; for (int c = 1; c < n; c++) { scanf("%i%i%i%i", &w1, &w2, &h1, &h2); if (w1 <= W1 && w2 >= W2 && h1 <= H1 && h2 >= H2) { W1 = w1; W2 = w2; H1 = h1; H2 = h2; } else { ret = ret && (w1 >= W1 && w2 <= W2 && h1 >= H1 && h2 <= H2); } } printf(ret ? "TAK\n" : "NIE\n"); } return 0; } |