#include <cstdio>
#include <algorithm>
#define scanf(args...) scanf(args) ? : 0
#define x1 first.first
#define x2 first.second
#define y1 second.first
#define y2 second.second
using namespace std;
typedef pair<pair<int,int>,pair<int,int>> P;
const int MAX=1e5+12;
int n;
P w[MAX];
bool check(P x)
{
for(int i=0;i<n;i++)
if(w[i]==x)
return true;
return false;
}
void solve()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d%d%d%d",&w[i].x1,&w[i].x2,&w[i].y1,&w[i].y2);
P x=w[0];
for(int i=0;i<n;i++)
{
x.x1=min(x.x1,w[i].x1);
x.x2=max(x.x2,w[i].x2);
x.y1=min(x.y1,w[i].y1);
x.y2=max(x.y2,w[i].y2);
}
printf("%s\n",check(x)?"TAK":"NIE");
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
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 | #include <cstdio> #include <algorithm> #define scanf(args...) scanf(args) ? : 0 #define x1 first.first #define x2 first.second #define y1 second.first #define y2 second.second using namespace std; typedef pair<pair<int,int>,pair<int,int>> P; const int MAX=1e5+12; int n; P w[MAX]; bool check(P x) { for(int i=0;i<n;i++) if(w[i]==x) return true; return false; } void solve() { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d%d%d%d",&w[i].x1,&w[i].x2,&w[i].y1,&w[i].y2); P x=w[0]; for(int i=0;i<n;i++) { x.x1=min(x.x1,w[i].x1); x.x2=max(x.x2,w[i].x2); x.y1=min(x.y1,w[i].y1); x.y2=max(x.y2,w[i].y2); } printf("%s\n",check(x)?"TAK":"NIE"); } int main() { int t; scanf("%d",&t); while(t--) solve(); } |
English