#include <stdio.h> int main() { int t; scanf( "%d", &t ); while(t--) { int n, fa, fb, fc, fd, a, b, c, d; fa = fc = a = c = 2000000000; fb = fd = b = d = 0; scanf( "%d", &n ); while(n--) { int ra, rb, rc, rd; scanf("%d%d%d%d", &ra, &rb, &rc, &rd ); if ( ra < a ) a = ra; if ( rc < c ) c = rc; if ( rb > b ) b = rb; if ( rd > d ) d = rd; if ( ra < fa || rc < fc || rb > fb || rd > fd ) { fa = ra; fb = rb; fc = rc; fd = rd; } } if ( fa == a && fb == b && fc == c && fd == d ) 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 | #include <stdio.h> int main() { int t; scanf( "%d", &t ); while(t--) { int n, fa, fb, fc, fd, a, b, c, d; fa = fc = a = c = 2000000000; fb = fd = b = d = 0; scanf( "%d", &n ); while(n--) { int ra, rb, rc, rd; scanf("%d%d%d%d", &ra, &rb, &rc, &rd ); if ( ra < a ) a = ra; if ( rc < c ) c = rc; if ( rb > b ) b = rb; if ( rd > d ) d = rd; if ( ra < fa || rc < fc || rb > fb || rd > fd ) { fa = ra; fb = rb; fc = rc; fd = rd; } } if ( fa == a && fb == b && fc == c && fd == d ) printf("TAK\n"); else printf("NIE\n"); } return 0; } |