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;
}

浙公网安备 33010602011771号