//============================================================================
// Name : lus.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
long w1, w2, h1, h2;
long wmin, wmax, hmin, hmax;
int t, n;
cin >> t;
for(;t;t--)
{
cin >> n;
cin >> wmin >> wmax >> hmin >> hmax;
bool major = true;
for(int i=2; i<=n; i++)
{
cin >> w1 >> w2 >> h1 >> h2;
if(w1<wmin) { major = false; wmin = w1; }
if(w2>wmax) { major = false; wmax = w2; }
if(h1<hmin) { major = false; hmin = h1; }
if(h2>hmax) { major = false; hmax = h2; }
if(wmin==w1 && wmax==w2 && hmin==h1 && hmax==h2) major=true;
}
cout << (major?"TAK":"NIE") << endl;
}
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 | //============================================================================ // Name : lus.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); long w1, w2, h1, h2; long wmin, wmax, hmin, hmax; int t, n; cin >> t; for(;t;t--) { cin >> n; cin >> wmin >> wmax >> hmin >> hmax; bool major = true; for(int i=2; i<=n; i++) { cin >> w1 >> w2 >> h1 >> h2; if(w1<wmin) { major = false; wmin = w1; } if(w2>wmax) { major = false; wmax = w2; } if(h1<hmin) { major = false; hmin = h1; } if(h2>hmax) { major = false; hmax = h2; } if(wmin==w1 && wmax==w2 && hmin==h1 && hmax==h2) major=true; } cout << (major?"TAK":"NIE") << endl; } return 0; } |
English