#include <cstdio> #include <set> #include <cmath> #include <utility> #include <vector> #include <string> #include <queue> #include <stack> #include <algorithm> #define MP make_pair #define ST first #define ND second #define PII pair<int,int> #define PIB pair<int,bool> #define PPIII pair<PII,int> #define PB push_back #define VI vector<int> #define VLI vector<long long> #define VVLI vector<VLI> #define VB vector<bool> #define VPII vector<PII> #define VPIB vector<PIB> #define PB push_back #define INF 1000000000 #define MOD 1000000007 using namespace std; int tab[4][100000]; int main() { // ios_base::sync_with_stdio(0); int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); int ux=0, dx=INF, uy=0, dy=INF; for(int i=0;i<n;++i) { for(int j=0;j<4;++j) { scanf("%d", &tab[j][i]); } if(tab[0][i]<dx) dx=tab[0][i]; if(tab[1][i]>ux) ux=tab[1][i]; if(tab[2][i]<dy) dy=tab[2][i]; if(tab[3][i]>uy) uy=tab[3][i]; } bool b=true; for(int i=0;i<n;++i) { if(dx==tab[0][i] and ux==tab[1][i] and dy==tab[2][i] and uy==tab[3][i]) { b=false; puts("TAK"); break; } } if(b) puts("NIE"); } 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 75 76 77 | #include <cstdio> #include <set> #include <cmath> #include <utility> #include <vector> #include <string> #include <queue> #include <stack> #include <algorithm> #define MP make_pair #define ST first #define ND second #define PII pair<int,int> #define PIB pair<int,bool> #define PPIII pair<PII,int> #define PB push_back #define VI vector<int> #define VLI vector<long long> #define VVLI vector<VLI> #define VB vector<bool> #define VPII vector<PII> #define VPIB vector<PIB> #define PB push_back #define INF 1000000000 #define MOD 1000000007 using namespace std; int tab[4][100000]; int main() { // ios_base::sync_with_stdio(0); int t; scanf("%d", &t); while(t--) { int n; scanf("%d", &n); int ux=0, dx=INF, uy=0, dy=INF; for(int i=0;i<n;++i) { for(int j=0;j<4;++j) { scanf("%d", &tab[j][i]); } if(tab[0][i]<dx) dx=tab[0][i]; if(tab[1][i]>ux) ux=tab[1][i]; if(tab[2][i]<dy) dy=tab[2][i]; if(tab[3][i]>uy) uy=tab[3][i]; } bool b=true; for(int i=0;i<n;++i) { if(dx==tab[0][i] and ux==tab[1][i] and dy==tab[2][i] and uy==tab[3][i]) { b=false; puts("TAK"); break; } } if(b) puts("NIE"); } return 0; } |