#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; #define N 120000 int n,m,t,p,x,ans,sg[2][N],mex[N]; int nxt(int x,int y){return (x==y)?y+1:x/(x/(y+1));} int main(){ scanf("%d",&n); m=(int)sqrt(n); sg[0][1]=1; for (int i=2;i<=n;i=nxt(n,i)){ int tmp=0,now=0; for (int j=2;j<=i;j=nxt(i,j)){ x=i/j; if (x<=m) tmp=sg[0][x]; else tmp=sg[1][n/x]; mex[now^tmp]=i; if ((i/x-i/(x+1))&1) now^=tmp; } if (i<=m) sg[0][i]=1; else sg[1][n/i]=1; for (int j=1;mex[j]==i;j++) if (i<=m) sg[0][i]=j+1; else sg[1][n/i]=j+1; } scanf("%d",&t); while (t--){ scanf("%d",&p); ans=0; for (int i=1;i<=p;i++){scanf("%d",&x); x=n/x; ans^=x<=m?sg[0][x]:sg[1][n/x];} if (ans) puts("Yes"); else puts("No"); } return 0; }
|