#include <cstdio> using namespace std; int main (){ int a, aa, b, bb, x, xx, y, yy, n, i, t, j; bool p; // 1 TAK 0 NIE scanf("%d", &t); for(i = 1; i < t+1; i++) { scanf("%d", &n); a = 1000000001; aa = -1; b = 1000000001; bb = -1; p = 1; for(j = 1; j < n+1; j++) { scanf("%d", &x); scanf("%d", &xx); scanf("%d", &y); scanf("%d", &yy); if( x <= a && xx >= aa && y <= b && yy >= bb) { a = x; aa = xx; b = y; bb = yy; p = 1; } if( x < a ){ a = x; p = 0; } if( xx > aa){ aa = xx; p = 0; } if( y < b){ b = y; p = 0; } if( yy > bb){ bb = yy; p = 0; } } if( p == 1) 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 | #include <cstdio> using namespace std; int main (){ int a, aa, b, bb, x, xx, y, yy, n, i, t, j; bool p; // 1 TAK 0 NIE scanf("%d", &t); for(i = 1; i < t+1; i++) { scanf("%d", &n); a = 1000000001; aa = -1; b = 1000000001; bb = -1; p = 1; for(j = 1; j < n+1; j++) { scanf("%d", &x); scanf("%d", &xx); scanf("%d", &y); scanf("%d", &yy); if( x <= a && xx >= aa && y <= b && yy >= bb) { a = x; aa = xx; b = y; bb = yy; p = 1; } if( x < a ){ a = x; p = 0; } if( xx > aa){ aa = xx; p = 0; } if( y < b){ b = y; p = 0; } if( yy > bb){ bb = yy; p = 0; } } if( p == 1) printf("TAK\n"); else printf("NIE\n"); } return 0; } |