// Lupus Nocawy 13 V 2014, PA2014
// http://potyczki.mimuw.edu.pl/
// Runda 1
// Zadanie: LUS
// Lustra [B]
#include <cstdio>
#include <iostream>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0, _n=n; i<_n; ++i)
#define FOR(i,a,b) for(int i=(a), _b=(b); i<=_b; ++i)
#define FORD(i,a,b) for(int i=(a), _b=(b); i>=_b; --i)
#define IT(i,x) __typeof__(x) i=x
#define FOREACH(it,x) for(__typeof__((x).begin()) it=(x).begin(); it!=(x).end(); ++it)
#define ALL(x) x.begin(),x.end()
#define MP make_pair
#define PB push_back
#define DEBUG(x) if(debug) cout << x << endl;
typedef long long int lli;
typedef unsigned long long int llu;
typedef pair<int,int> pii;
const int debug=0;
const int INF = 2147483647;
const int max_n = 100000;
void solve(void){
int n;
scanf("%d ", &n);
bool majoranta=0;
int W1=INF, W2=0, H1=INF, H2=0; // extrema
REP(i,n){
int w1,w2,h1,h2;
scanf("%d %d %d %d ", &w1, &w2, &h1, &h2);
if(w1<W1){W1=w1;majoranta=0;}
if(w2>W2){W2=w2;majoranta=0;}
if(h1<H1){H1=h1;majoranta=0;}
if(h2>H2){H2=h2;majoranta=0;}
if(w1==W1 && w2==W2 && h1==H1 && h2==H2) majoranta=1;
}
printf(majoranta?"TAK\n":"NIE\n");
return;
}
int main(void){
int t;
scanf("%d ", &t);
while(t--)
solve();
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 | // Lupus Nocawy 13 V 2014, PA2014 // http://potyczki.mimuw.edu.pl/ // Runda 1 // Zadanie: LUS // Lustra [B] #include <cstdio> #include <iostream> #include <cassert> #include <cstring> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <stack> #include <list> #include <set> #include <map> #include <cmath> using namespace std; #define REP(i,n) for(int i=0, _n=n; i<_n; ++i) #define FOR(i,a,b) for(int i=(a), _b=(b); i<=_b; ++i) #define FORD(i,a,b) for(int i=(a), _b=(b); i>=_b; --i) #define IT(i,x) __typeof__(x) i=x #define FOREACH(it,x) for(__typeof__((x).begin()) it=(x).begin(); it!=(x).end(); ++it) #define ALL(x) x.begin(),x.end() #define MP make_pair #define PB push_back #define DEBUG(x) if(debug) cout << x << endl; typedef long long int lli; typedef unsigned long long int llu; typedef pair<int,int> pii; const int debug=0; const int INF = 2147483647; const int max_n = 100000; void solve(void){ int n; scanf("%d ", &n); bool majoranta=0; int W1=INF, W2=0, H1=INF, H2=0; // extrema REP(i,n){ int w1,w2,h1,h2; scanf("%d %d %d %d ", &w1, &w2, &h1, &h2); if(w1<W1){W1=w1;majoranta=0;} if(w2>W2){W2=w2;majoranta=0;} if(h1<H1){H1=h1;majoranta=0;} if(h2>H2){H2=h2;majoranta=0;} if(w1==W1 && w2==W2 && h1==H1 && h2==H2) majoranta=1; } printf(majoranta?"TAK\n":"NIE\n"); return; } int main(void){ int t; scanf("%d ", &t); while(t--) solve(); return 0; } |
English