#include<cstdio>
#include<algorithm>
#include<cassert>
#include<complex>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>
#include<set>
#include<string>
#include<vector>
#include<iostream>
#include<cstring>
#include<stack>
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define fup FOR
#define fdo FORD
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define siz SZ
#define CLR(x) memset((x), 0, sizeof(x))
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define FI X
#define SE Y
#define SQR(a) ((a)*(a))
#define DEBUG 1
#define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; }
#define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cout <<endl; }}
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int, int>P;
typedef vector<int>VI;
const int INF=1E9+7;
template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
const int MAX = 100032;
int n, w1[MAX], w2[MAX], h1[MAX], h2[MAX];
int main(){
ios_base::sync_with_stdio(false);
cout << setprecision(15) << fixed;
int t; cin>>t;
FOR(i,1,t) {
int w1m=INF, w2M=0, h1m=INF, h2M=0;
cin>>n;
FOR(j,1,n) {
cin>>w1[j]>>w2[j]>>h1[j]>>h2[j];
mini(w1m,w1[j]);
maxi(w2M,w2[j]);
mini(h1m,h1[j]);
maxi(h2M,h2[j]);
}
bool found = false;
FOR(j,1,n) {
if (w1[j]==w1m && w2[j]==w2M &&
h1[j]==h1m && h2[j]==h2M ) {
found = true;
break;
}
}
cout<<(found?"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 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 73 74 | #include<cstdio> #include<algorithm> #include<cassert> #include<complex> #include<map> #include<iomanip> #include<sstream> #include<queue> #include<set> #include<string> #include<vector> #include<iostream> #include<cstring> #include<stack> #define FOR(i, a, b) for(int i =(a); i <=(b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define fup FOR #define fdo FORD #define REP(i, n) for(int i = 0;i <(n); ++i) #define VAR(v, i) __typeof(i) v=(i) #define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define siz SZ #define CLR(x) memset((x), 0, sizeof(x)) #define PB push_back #define MP make_pair #define X first #define Y second #define FI X #define SE Y #define SQR(a) ((a)*(a)) #define DEBUG 1 #define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; } #define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cout <<endl; }} using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int>P; typedef vector<int>VI; const int INF=1E9+7; template<class C> void mini(C&a4, C b4){a4=min(a4, b4); } template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); } const int MAX = 100032; int n, w1[MAX], w2[MAX], h1[MAX], h2[MAX]; int main(){ ios_base::sync_with_stdio(false); cout << setprecision(15) << fixed; int t; cin>>t; FOR(i,1,t) { int w1m=INF, w2M=0, h1m=INF, h2M=0; cin>>n; FOR(j,1,n) { cin>>w1[j]>>w2[j]>>h1[j]>>h2[j]; mini(w1m,w1[j]); maxi(w2M,w2[j]); mini(h1m,h1[j]); maxi(h2M,h2[j]); } bool found = false; FOR(j,1,n) { if (w1[j]==w1m && w2[j]==w2M && h1[j]==h1m && h2[j]==h2M ) { found = true; break; } } cout<<(found?"TAK":"NIE")<<endl; } return 0; } |
English