luogu_2148 [SDOI2009]E&D

#include <cstdio>
#include <iostream>
using namespace std;
int n,SG,T;

int getSG(int x,int y){
    int num=0;
    while(1){
        if(x&1 && y&1)return num;
        if(x&1)x++;
        else if(y&1)y++;
        else {
            x>>=1;
            y>>=1;
            num++;
        }
    }
}

int main(){
    scanf("%d",&T);
    while(T--){
        SG=0;
        scanf("%d",&n);
        for(int i=1;i<=n/2;i++){
            int a,b;
            scanf("%d%d",&a,&b);
            SG^=getSG(a,b);
        }
        if(SG)puts("YES");
        else puts("NO");
    }
    return 0;
}

  

posted @ 2017-10-07 20:34  wqtnb_tql_qwq_%%%  阅读(151)  评论(0编辑  收藏  举报