#include <cstdio> #define scanInt(i) scanf("%d", &(i)) #define scanMirrorTo(s) scanf("%d %d %d %d", &(s).w1, &(s).w2, &(s).h1, &(s).h2) struct mirror { int w1, w2, h1, h2; }; int main() { int t, n; mirror current, major; bool state; // TAK scanInt(t); while(t--) { scanInt(n); scanMirrorTo(major); state = true; while(--n) { scanMirrorTo(current); if( current.w1 < major.w1 ) { major.w1 = current.w1; state = false; } if( current.w2 > major.w2 ) { major.w2 = current.w2; state = false; } if( current.h1 < major.h1 ) { major.h1 = current.h1; state = false; } if( current.h2 > major.h2 ) { major.h2 = current.h2; state = false; } if( current.w1 == major.w1 and current.w2 == major.w2 and current.h1 == major.h1 and current.h2 == major.h2 ) state = true; } printf("%s\n", state ? "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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include <cstdio> #define scanInt(i) scanf("%d", &(i)) #define scanMirrorTo(s) scanf("%d %d %d %d", &(s).w1, &(s).w2, &(s).h1, &(s).h2) struct mirror { int w1, w2, h1, h2; }; int main() { int t, n; mirror current, major; bool state; // TAK scanInt(t); while(t--) { scanInt(n); scanMirrorTo(major); state = true; while(--n) { scanMirrorTo(current); if( current.w1 < major.w1 ) { major.w1 = current.w1; state = false; } if( current.w2 > major.w2 ) { major.w2 = current.w2; state = false; } if( current.h1 < major.h1 ) { major.h1 = current.h1; state = false; } if( current.h2 > major.h2 ) { major.h2 = current.h2; state = false; } if( current.w1 == major.w1 and current.w2 == major.w2 and current.h1 == major.h1 and current.h2 == major.h2 ) state = true; } printf("%s\n", state ? "TAK" : "NIE"); } return (0); } |