//Michał Glapa #include<cstdio> #include<algorithm> using namespace std; #define FOR(i,j,k) for(int i=j;i<k;i++) #define x first #define y second #define REP(i,n) FOR(i,0,n) #define mini(x,y) x=min(x,y) #define maxi(x,y) x=max(x,y) const int INF = 1000000009; typedef pair<int,int> pii; const int MX = 100007; pii w[MX], h[MX]; int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); REP(i,n) scanf("%d %d %d %d",&w[i].x,&w[i].y,&h[i].x,&h[i].y); int minw = INF, maxw = -INF, minh =INF, maxh = -INF; REP(i,n) { mini(minw,w[i].x); maxi(maxw,w[i].y); mini(minh,h[i].x); maxi(maxh,h[i].y); } bool res=false; REP(i,n) if(w[i].x==minw && w[i].y==maxw &&h[i].x==minh && h[i].y==maxh) res=true; printf("%s\n",res ? "TAK" :"NIE"); } }
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 | //Michał Glapa #include<cstdio> #include<algorithm> using namespace std; #define FOR(i,j,k) for(int i=j;i<k;i++) #define x first #define y second #define REP(i,n) FOR(i,0,n) #define mini(x,y) x=min(x,y) #define maxi(x,y) x=max(x,y) const int INF = 1000000009; typedef pair<int,int> pii; const int MX = 100007; pii w[MX], h[MX]; int main() { int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); REP(i,n) scanf("%d %d %d %d",&w[i].x,&w[i].y,&h[i].x,&h[i].y); int minw = INF, maxw = -INF, minh =INF, maxh = -INF; REP(i,n) { mini(minw,w[i].x); maxi(maxw,w[i].y); mini(minh,h[i].x); maxi(maxh,h[i].y); } bool res=false; REP(i,n) if(w[i].x==minw && w[i].y==maxw &&h[i].x==minh && h[i].y==maxh) res=true; printf("%s\n",res ? "TAK" :"NIE"); } } |