SHARE
TWEET

DEMO_F

a guest Oct 15th, 2012 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <cstdio>
  2.  
  3. int main(){
  4.     int oleg;
  5.     scanf("%d", &oleg);
  6.     for (int w=0; w<oleg; w++){
  7.         int n;
  8.         scanf("%d", &n);
  9.         if (n==0){
  10.             putchar('1');
  11.             continue;
  12.         }
  13.         int x,y;
  14.         scanf("%d%d", &x, &y);
  15.         int t=((x-y)&1);
  16.         int i=-1;
  17.         for (i=1; i<n; i++){
  18.             scanf("%d%d", &x, &y);
  19.             if ((((x-y)&1)^t)==1){
  20.                 putchar('0');
  21.                 break;
  22.             }
  23.         }
  24.         if (i==n) putchar('1');
  25.     }
  26.     putchar('\n');
  27.     return 0;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top