#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector <pair <pair <int, int>, pair <int, int> > > v;
int main()
{
int test, n;
scanf("%d", &test);
for(int x=0;x<test;x++)
{
int w1, w2, h1, h2;
scanf("%d", &n);
v.resize(n);
w1=1000000002;
w2=0;
h1=1000000002;
h2=0;
for(int i=0;i<n;i++)
{
scanf("%d %d %d %d", &v[i].first.first, &v[i].first.second, &v[i].second.first, &v[i].second.second);
w1=min(w1, v[i].first.first);
w2=max(w2, v[i].first.second);
h1=min(h1, v[i].second.first);
h2=max(h2, v[i].second.second);
v[i].first.second=-v[i].first.second;
v[i].second.second=-v[i].second.second;
}
sort(v.begin(), v.end());
if(w1==v[0].first.first && w2==-v[0].first.second && h1==v[0].second.first && h2==-v[0].second.second)
printf("TAK\n");
else
printf("NIE\n");
v.clear();
}
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 | #include <cstdlib> #include <cstdio> #include <iostream> #include <vector> #include <algorithm> using namespace std; vector <pair <pair <int, int>, pair <int, int> > > v; int main() { int test, n; scanf("%d", &test); for(int x=0;x<test;x++) { int w1, w2, h1, h2; scanf("%d", &n); v.resize(n); w1=1000000002; w2=0; h1=1000000002; h2=0; for(int i=0;i<n;i++) { scanf("%d %d %d %d", &v[i].first.first, &v[i].first.second, &v[i].second.first, &v[i].second.second); w1=min(w1, v[i].first.first); w2=max(w2, v[i].first.second); h1=min(h1, v[i].second.first); h2=max(h2, v[i].second.second); v[i].first.second=-v[i].first.second; v[i].second.second=-v[i].second.second; } sort(v.begin(), v.end()); if(w1==v[0].first.first && w2==-v[0].first.second && h1==v[0].second.first && h2==-v[0].second.second) printf("TAK\n"); else printf("NIE\n"); v.clear(); } return 0; } |
English