#include <tuple>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <set>
#include <fstream>
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define PB push_back
#define ST first
#define ND second
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
using namespace std;
int n,m;
set<tuple<int,int,int,int> > wykona;
int main()
{
ios_base::sync_with_stdio(0);
int t;
cin>>t;
REP(q,t){
wykona.clear();
int minh = 1000000001,minw = 1000000001,maxh = 0,maxw = 0;
int n;
cin>>n;
REP(i,n){
int t1,t2,t3,t4;
cin>>t1>>t2>>t3>>t4;
minw = min(t1,minw);
maxw = max(t2,maxw);
minh = min(t3,minh);
maxh = max(t4,maxh);
auto x = make_tuple(t1,t2,t3,t4);
wykona.insert(x);
}
auto y = make_tuple(minw, maxw, minh, maxh);
if(wykona.find(y) != wykona.end()){
cout<<"TAK\n";
} else{
cout<<"NIE\n";
}
}
}
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 | #include <tuple> #include <cstdio> #include <iostream> #include <algorithm> #include <iterator> #include <string> #include <vector> #include <set> #include <fstream> using namespace std; typedef long long LL; typedef pair<int,int> PII; #define MP make_pair #define FOR(v,p,k) for(int v=p;v<=k;++v) #define FORD(v,p,k) for(int v=p;v>=k;--v) #define REP(i,n) for(int i=0;i<(n);++i) #define VAR(v,i) __typeof(i) v=(i) #define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i) #define PB push_back #define ST first #define ND second #define SIZE(x) (int)x.size() #define ALL(c) c.begin(),c.end() using namespace std; int n,m; set<tuple<int,int,int,int> > wykona; int main() { ios_base::sync_with_stdio(0); int t; cin>>t; REP(q,t){ wykona.clear(); int minh = 1000000001,minw = 1000000001,maxh = 0,maxw = 0; int n; cin>>n; REP(i,n){ int t1,t2,t3,t4; cin>>t1>>t2>>t3>>t4; minw = min(t1,minw); maxw = max(t2,maxw); minh = min(t3,minh); maxh = max(t4,maxh); auto x = make_tuple(t1,t2,t3,t4); wykona.insert(x); } auto y = make_tuple(minw, maxw, minh, maxh); if(wykona.find(y) != wykona.end()){ cout<<"TAK\n"; } else{ cout<<"NIE\n"; } } } |
English