/************************************************************************* * Zadanie: Lustra * * Zlozonosc czasowa: O(tn) * * Wynik: --/10 * *************************************************************************/ #include <iostream> #define INF 1000000001 using namespace std; /*************************************************************************/ int main() { ios_base::sync_with_stdio(0); int t; cin >> t; while (t--) { int n; cin >> n; int min_w = INF, max_w = 0, min_h = INF, max_h = 0; bool ans = 0; while (n--) { int w1, w2, h1, h2; cin >> w1 >> w2 >> h1 >> h2; bool change = 0; if (w1 < min_w) { min_w = w1; change = 1; } if (w2 > max_w) { max_w = w2; change = 1; } if (h1 < min_h) { min_h = h1; change = 1; } if (h2 > max_h) { max_h = h2; change = 1; } if (change || !ans) ans = (w1 == min_w && w2 == max_w && h1 == min_h && h2 == max_h); } cout << ( (ans)? "TAK" : "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 48 49 50 51 52 | /************************************************************************* * Zadanie: Lustra * * Zlozonosc czasowa: O(tn) * * Wynik: --/10 * *************************************************************************/ #include <iostream> #define INF 1000000001 using namespace std; /*************************************************************************/ int main() { ios_base::sync_with_stdio(0); int t; cin >> t; while (t--) { int n; cin >> n; int min_w = INF, max_w = 0, min_h = INF, max_h = 0; bool ans = 0; while (n--) { int w1, w2, h1, h2; cin >> w1 >> w2 >> h1 >> h2; bool change = 0; if (w1 < min_w) { min_w = w1; change = 1; } if (w2 > max_w) { max_w = w2; change = 1; } if (h1 < min_h) { min_h = h1; change = 1; } if (h2 > max_h) { max_h = h2; change = 1; } if (change || !ans) ans = (w1 == min_w && w2 == max_w && h1 == min_h && h2 == max_h); } cout << ( (ans)? "TAK" : "NIE" ) << '\n'; } return 0; } /*************************************************************************/ |