#include<cstdio> #include<algorithm> #include<iostream> #include<fstream> #include<iomanip> #include<vector> #include<map> #include<set> #include<stack> #define SC(n) scanf("%d", &n) #define SC2(n, m) scanf("%d %d", &n, &m) #define SCC(c) scanf(" %c", &c) #define SCS(b) scanf("%s", b) #define REP(i, n) for(int i = 0; i < (n); ++i) #define FORE(i, a, b) for(int i = (a); i <= (b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define FORIT(i, c, typ) for(typ::iterator i = c.begin(); i != c.end(); ++i) #define PR(n) printf("%d ", (int) (n)) #define PRN(n) printf("%d\n", (int) (n)) #define elif else if #define pb push_back #define mp make_pair #define xx first #define yy second #define all(v) v.begin(), v.end() #define itr iterator #define DBG if(0) printf using namespace std; typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef vector<pi> vpi; typedef pair<int, pi> pii; typedef vector<pii> vpii; typedef vector<vpi> vvpi; typedef map<int, vpi> mvpi; const int NMAX = 1000009, INF = 1000*1000*1000 + 3; int tn, n, min_w, min_h, max_w, max_h, cand; int w1[NMAX], w2[NMAX], h1[NMAX], h2[NMAX]; int main() { SC(tn); REP(ti, tn) { SC(n); min_w = min_h = INF; max_w = max_h = 0; cand = 0; REP(i,n) { scanf("%d %d %d %d", &w1[i], &w2[i], &h1[i], &h2[i]); min_w = min(min_w, w1[i]); max_w = max(max_w, w2[i]); min_h = min(min_h, h1[i]); max_h = max(max_h, h2[i]); } REP(i, n) if(w1[i] == min_w && w2[i] == max_w && h1[i] == min_h && h2[i] == max_h) { cand = 1; break; } if(cand) printf("TAK\n"); else printf("NIE\n"); } 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #include<cstdio> #include<algorithm> #include<iostream> #include<fstream> #include<iomanip> #include<vector> #include<map> #include<set> #include<stack> #define SC(n) scanf("%d", &n) #define SC2(n, m) scanf("%d %d", &n, &m) #define SCC(c) scanf(" %c", &c) #define SCS(b) scanf("%s", b) #define REP(i, n) for(int i = 0; i < (n); ++i) #define FORE(i, a, b) for(int i = (a); i <= (b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define FORIT(i, c, typ) for(typ::iterator i = c.begin(); i != c.end(); ++i) #define PR(n) printf("%d ", (int) (n)) #define PRN(n) printf("%d\n", (int) (n)) #define elif else if #define pb push_back #define mp make_pair #define xx first #define yy second #define all(v) v.begin(), v.end() #define itr iterator #define DBG if(0) printf using namespace std; typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef vector<pi> vpi; typedef pair<int, pi> pii; typedef vector<pii> vpii; typedef vector<vpi> vvpi; typedef map<int, vpi> mvpi; const int NMAX = 1000009, INF = 1000*1000*1000 + 3; int tn, n, min_w, min_h, max_w, max_h, cand; int w1[NMAX], w2[NMAX], h1[NMAX], h2[NMAX]; int main() { SC(tn); REP(ti, tn) { SC(n); min_w = min_h = INF; max_w = max_h = 0; cand = 0; REP(i,n) { scanf("%d %d %d %d", &w1[i], &w2[i], &h1[i], &h2[i]); min_w = min(min_w, w1[i]); max_w = max(max_w, w2[i]); min_h = min(min_h, h1[i]); max_h = max(max_h, h2[i]); } REP(i, n) if(w1[i] == min_w && w2[i] == max_w && h1[i] == min_h && h2[i] == max_h) { cand = 1; break; } if(cand) printf("TAK\n"); else printf("NIE\n"); } return 0; } |