// lus.cpp : Defines the entry point for the console application. // void lus() { int i, n, w1, w2, h1, h2, w1m, w2m, h1m, h2m, r; w1m = 1000000000; w2m = 0; h1m = 1000000000; h2m = 0; r = 0; scanf("%d", &n); for (i=0; i<n; i++) { scanf("%d%d%d%d", &w1, &w2, &h1, &h2); if (w1<w1m) { w1m = w1; r = 0; } if (w2>w2m) { w2m = w2; r = 0; } if (h1<h1m) { h1m = h1; r = 0; } if (h2>h2m) { h2m = h2; r = 0; } if (r==0 && w1<=w1m && w2>=w2m && h1<=h1m && h2>=h2m) r = 1; } printf("%s\n", (r==0) ? "NIE" : "TAK"); } int main() { int t; scanf("%d", &t); while (t--) lus(); 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 56 57 58 59 60 | // lus.cpp : Defines the entry point for the console application. // void lus() { int i, n, w1, w2, h1, h2, w1m, w2m, h1m, h2m, r; w1m = 1000000000; w2m = 0; h1m = 1000000000; h2m = 0; r = 0; scanf("%d", &n); for (i=0; i<n; i++) { scanf("%d%d%d%d", &w1, &w2, &h1, &h2); if (w1<w1m) { w1m = w1; r = 0; } if (w2>w2m) { w2m = w2; r = 0; } if (h1<h1m) { h1m = h1; r = 0; } if (h2>h2m) { h2m = h2; r = 0; } if (r==0 && w1<=w1m && w2>=w2m && h1<=h1m && h2>=h2m) r = 1; } printf("%s\n", (r==0) ? "NIE" : "TAK"); } int main() { int t; scanf("%d", &t); while (t--) lus(); return 0; } |