#include <iostream> #include <vector> using namespace std; struct lustro { int a,b,c,d; bool operator< (const lustro& o) const { return o.a < a or o.b > b or o.c < c or o.d > d; } }; bool solve(vector<lustro>& L) { lustro b = L[0]; for (auto& l : L) if (b < l) b = l; for (auto& l : L) if (b < l) return false; return true; } void onecase() { size_t N; cin >> N; vector<lustro> L(N); for(size_t i=0;i<N;i++) cin >> L[i].a >> L[i].b >> L[i].c >> L[i].d; cout << (solve(L)?"TAK":"NIE") << endl; } int main() { ios_base::sync_with_stdio(false); size_t Z; cin >> Z; while(Z--) onecase(); 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 | #include <iostream> #include <vector> using namespace std; struct lustro { int a,b,c,d; bool operator< (const lustro& o) const { return o.a < a or o.b > b or o.c < c or o.d > d; } }; bool solve(vector<lustro>& L) { lustro b = L[0]; for (auto& l : L) if (b < l) b = l; for (auto& l : L) if (b < l) return false; return true; } void onecase() { size_t N; cin >> N; vector<lustro> L(N); for(size_t i=0;i<N;i++) cin >> L[i].a >> L[i].b >> L[i].c >> L[i].d; cout << (solve(L)?"TAK":"NIE") << endl; } int main() { ios_base::sync_with_stdio(false); size_t Z; cin >> Z; while(Z--) onecase(); return 0; } |