#include <stdio.h>
typedef struct lustro {
int w1, w2, h1, h2;
} lustro_t;
lustro_t lustra[100000];
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
int main() {
int t;
scanf("%d", &t);
while (t--) {
int i, n, ok = 0;
lustro_t major;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d%d%d%d", &lustra[i].w1, &lustra[i].w2, &lustra[i].h1, &lustra[i].h2);
major = lustra[0];
for (i = 1; i < n; i++) {
major.w1 = min(major.w1, lustra[i].w1);
major.h1 = min(major.h1, lustra[i].h1);
major.w2 = max(major.w2, lustra[i].w2);
major.h2 = max(major.h2, lustra[i].h2);
}
for (i = 0; i < n; i++)
if (major.w1 == lustra[i].w1 && major.w2 == lustra[i].w2 && major.h1 == lustra[i].h1 && major.h2 == lustra[i].h2) {
ok = 1;
break;
}
puts(ok ? "TAK" : "NIE");
}
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 | #include <stdio.h> typedef struct lustro { int w1, w2, h1, h2; } lustro_t; lustro_t lustra[100000]; #define min(a,b) ((a) < (b) ? (a) : (b)) #define max(a,b) ((a) > (b) ? (a) : (b)) int main() { int t; scanf("%d", &t); while (t--) { int i, n, ok = 0; lustro_t major; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d%d%d%d", &lustra[i].w1, &lustra[i].w2, &lustra[i].h1, &lustra[i].h2); major = lustra[0]; for (i = 1; i < n; i++) { major.w1 = min(major.w1, lustra[i].w1); major.h1 = min(major.h1, lustra[i].h1); major.w2 = max(major.w2, lustra[i].w2); major.h2 = max(major.h2, lustra[i].h2); } for (i = 0; i < n; i++) if (major.w1 == lustra[i].w1 && major.w2 == lustra[i].w2 && major.h1 == lustra[i].h1 && major.h2 == lustra[i].h2) { ok = 1; break; } puts(ok ? "TAK" : "NIE"); } return 0; } |
English