#include<cstdio> using namespace std; void get(int &x){ char c; while ((c=getchar_unlocked())<'0'); x=c-'0'; while ((c=getchar_unlocked())>='0') x=x*10+c-'0'; } int p,k; int w1,w2,h1,h2,ster=1; int main() { get(p); while(p--){ get(k); while(k--){ get(w1);get(w2);get(h1);get(h2); if(ster==1||ster==w2*h2) ster=w2*h2; else{ster=0; break;} } if(ster==0){ster=1; printf("TAK\n");} else if(ster!=0) 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 | #include<cstdio> using namespace std; void get(int &x){ char c; while ((c=getchar_unlocked())<'0'); x=c-'0'; while ((c=getchar_unlocked())>='0') x=x*10+c-'0'; } int p,k; int w1,w2,h1,h2,ster=1; int main() { get(p); while(p--){ get(k); while(k--){ get(w1);get(w2);get(h1);get(h2); if(ster==1||ster==w2*h2) ster=w2*h2; else{ster=0; break;} } if(ster==0){ster=1; printf("TAK\n");} else if(ster!=0) printf("NIE\n"); } return 0; } |