#include <iostream>
using namespace std;
int t;
int n;
int w1[100008];
int w2[100008];
int h1[100008];
int h2[100008];
int mw;
int ww;
int mh;
int wh;
bool wynik[11];
int main()
{
cin >> t;
for ( int a=0; a<t; a++ )
{
cin >> n;
mw=1000000001;
mh=1000000001;
ww=0;
wh=0;
for ( int i=0; i<n; i++ )
{
cin >> w1[i];
if ( w1[i]<mw )
{
mw=w1[i];
}
cin >> w2[i];
if ( w2[i]>ww )
{
ww=w2[i];
}
cin >> h1[i];
if ( h1[i]<mh )
{
mh=h1[i];
}
cin >> h2[i];
if ( h2[i]>wh )
{
wh=h2[i];
}
}
for ( int i=0; i<n; i++ )
{
if( w1[i]==mw && w2[i]==ww && h1[i]==mh && h2[i]==wh )
{
wynik[a]=true;
break;
}
}
}
for ( int i=0; i<t; i++ )
{
if ( wynik[i]==true )
{
cout << "TAK" << endl;
}
else
{
cout << "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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #include <iostream> using namespace std; int t; int n; int w1[100008]; int w2[100008]; int h1[100008]; int h2[100008]; int mw; int ww; int mh; int wh; bool wynik[11]; int main() { cin >> t; for ( int a=0; a<t; a++ ) { cin >> n; mw=1000000001; mh=1000000001; ww=0; wh=0; for ( int i=0; i<n; i++ ) { cin >> w1[i]; if ( w1[i]<mw ) { mw=w1[i]; } cin >> w2[i]; if ( w2[i]>ww ) { ww=w2[i]; } cin >> h1[i]; if ( h1[i]<mh ) { mh=h1[i]; } cin >> h2[i]; if ( h2[i]>wh ) { wh=h2[i]; } } for ( int i=0; i<n; i++ ) { if( w1[i]==mw && w2[i]==ww && h1[i]==mh && h2[i]==wh ) { wynik[a]=true; break; } } } for ( int i=0; i<t; i++ ) { if ( wynik[i]==true ) { cout << "TAK" << endl; } else { cout << "NIE" << endl; } } return 0; } |
English