#include <cstdio> int main() { int a, b, c, d, e, f, g, h, i, j, k, l, m; scanf("%d", &a); while(a--) { m=l=k=0; scanf("%d", &b); scanf("%d %d %d %d", &c, &d, &e, &f); while(--b) { scanf("%d %d %d %d", &g, &h, &i, &j); if( g == c ) l++; if( g < c ) m++, c = g; if( h == d ) l++; if( h > d ) m++, d = h; if( i == e ) l++; if( i < e ) m++, e = i; if( j == f ) l++; if( j > f ) m++, f = j; if( (m & 3) && ( (m+l) & 3 ) ) k=1; else if( (m+l)&3 ) k = 0; } if(k) printf("NIE\n"); else printf("TAK\n"); } }
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 | #include <cstdio> int main() { int a, b, c, d, e, f, g, h, i, j, k, l, m; scanf("%d", &a); while(a--) { m=l=k=0; scanf("%d", &b); scanf("%d %d %d %d", &c, &d, &e, &f); while(--b) { scanf("%d %d %d %d", &g, &h, &i, &j); if( g == c ) l++; if( g < c ) m++, c = g; if( h == d ) l++; if( h > d ) m++, d = h; if( i == e ) l++; if( i < e ) m++, e = i; if( j == f ) l++; if( j > f ) m++, f = j; if( (m & 3) && ( (m+l) & 3 ) ) k=1; else if( (m+l)&3 ) k = 0; } if(k) printf("NIE\n"); else printf("TAK\n"); } } |