#include <iostream>
using namespace std;
#define REP(x, n) for(int x=0; x<(n); ++x)
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x = (b); x>=(e); --x)
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
#define MP make_pair
#define PB push_back
#define PF push_front
#define ST first
#define ND second
const int INF = 1000000001;
#define MAXN 100003
int w1[MAXN], w2[MAXN], h1[MAXN], h2[MAXN];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t, n;
cin >> t;
int w1t, w2t, h1t, h2t;
int minw, maxw, minh, maxh;
//int bestc;
bool git;
while(t--)
{
cin >> n;
minw = INF; minh = INF;
maxw = -1; maxh = -1;
//bestc = 0;
git = false;
FOR(i, 1, n)
{
cin >> w1t >> w2t >> h1t >> h2t;
w1[i] = w1t; w2[i] = w2t;
h1[i] = h1t; h2[i] = h2t;
if(w1t < minw)
minw = w1t;
if(w2t > maxw)
maxw = w2t;
if(h1t < minh)
minh = h1t;
if(h2t > maxh)
maxh = h2t;
}
FOR(i, 1, n)
{
if(w1[i] == minw && w2[i] == maxw &&
h1[i] == minh && h2[i] == maxh)
{
git = true;
break;
}//bestc++;
}
if(!git/*bestc == 0*/)
cout << "NIE\n";
else
cout << "TAK\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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #include <iostream> using namespace std; #define REP(x, n) for(int x=0; x<(n); ++x) #define FOR(x, b, e) for(int x=(b); x<=(e); ++x) #define FORD(x, b, e) for(int x = (b); x>=(e); --x) typedef pair<int, int> PII; typedef pair<double, double> PDD; #define MP make_pair #define PB push_back #define PF push_front #define ST first #define ND second const int INF = 1000000001; #define MAXN 100003 int w1[MAXN], w2[MAXN], h1[MAXN], h2[MAXN]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t, n; cin >> t; int w1t, w2t, h1t, h2t; int minw, maxw, minh, maxh; //int bestc; bool git; while(t--) { cin >> n; minw = INF; minh = INF; maxw = -1; maxh = -1; //bestc = 0; git = false; FOR(i, 1, n) { cin >> w1t >> w2t >> h1t >> h2t; w1[i] = w1t; w2[i] = w2t; h1[i] = h1t; h2[i] = h2t; if(w1t < minw) minw = w1t; if(w2t > maxw) maxw = w2t; if(h1t < minh) minh = h1t; if(h2t > maxh) maxh = h2t; } FOR(i, 1, n) { if(w1[i] == minw && w2[i] == maxw && h1[i] == minh && h2[i] == maxh) { git = true; break; }//bestc++; } if(!git/*bestc == 0*/) cout << "NIE\n"; else cout << "TAK\n"; } return 0; } |
English