#include<cstdio> #include<iostream> #include<algorithm> #include<vector> #include<tr1/unordered_map> #include<queue> #include<cstdlib> #include<list> #include<set> #include<map> #include<cmath> #define MP make_pair #define PB push_back #define s second #define f first #define PII pair<int,int> #define VPII vector <pair<int,int> > #define VI vector <int> #define abs(a) max((a),-(a)) #define LL long long #define LD long double #define ALL(x) x.begin(),x.end() #define PU putchar_unlocked #define GU getchar_unlocked #define DBG(x) cerr<<#x<<" "<<(x)<<endl; using namespace std; int a,b,c,d,e,f,n,m,mx,l,z,r,k; int wynik; char ch; int INF=1e9+1; int t[100004][4]; void solve() { int w0=INF,w1=0,h0=INF,h1=0; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d%d%d%d",&t[i][0],&t[i][1],&t[i][2],&t[i][3]); w0=min(w0,t[i][0]); w1=max(w1,t[i][1]); h0=min(h0,t[i][2]); h1=max(h1,t[i][3]); } for(int i=1;i<=n;i++) { if(w0==t[i][0]&&w1==t[i][1]&&h0==t[i][2]&&h1==t[i][3]) { puts("TAK"); return; } } puts("NIE"); } main() { scanf("%d",&z); while(z--)solve(); }
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 | #include<cstdio> #include<iostream> #include<algorithm> #include<vector> #include<tr1/unordered_map> #include<queue> #include<cstdlib> #include<list> #include<set> #include<map> #include<cmath> #define MP make_pair #define PB push_back #define s second #define f first #define PII pair<int,int> #define VPII vector <pair<int,int> > #define VI vector <int> #define abs(a) max((a),-(a)) #define LL long long #define LD long double #define ALL(x) x.begin(),x.end() #define PU putchar_unlocked #define GU getchar_unlocked #define DBG(x) cerr<<#x<<" "<<(x)<<endl; using namespace std; int a,b,c,d,e,f,n,m,mx,l,z,r,k; int wynik; char ch; int INF=1e9+1; int t[100004][4]; void solve() { int w0=INF,w1=0,h0=INF,h1=0; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d%d%d%d",&t[i][0],&t[i][1],&t[i][2],&t[i][3]); w0=min(w0,t[i][0]); w1=max(w1,t[i][1]); h0=min(h0,t[i][2]); h1=max(h1,t[i][3]); } for(int i=1;i<=n;i++) { if(w0==t[i][0]&&w1==t[i][1]&&h0==t[i][2]&&h1==t[i][3]) { puts("TAK"); return; } } puts("NIE"); } main() { scanf("%d",&z); while(z--)solve(); } |