博弈论+SG函数
这种题脑补不出来就把SG函数表打出来吧……
其实我是打表才发现:若a^b=c,则f[a]^f[b]=f[c] 的,然后好像就能乱搞了……
其他的我就什么都不说,这是最吼的。orz题解:http://blog.csdn.net/lych_cys/article/details/50896005
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define N 70005
using namespace std;
namespace runzhe2000
{
int n, m, a[N], c[2][N], vis[N];
int nxt(int x,int y){ return (x==y)?y+1:y/(y/(x+1)); }
void pre(){
int i,j,now,x,t,cnt;
for (i=1; i <= n; i=nxt(i,n)){
now = cnt = 0;
for (j=2; j<=i; j = nxt(j,i)){
x=i/j; t = (x>m) ? c[1][n/x] :c[0][x];
a[++cnt]=now^t; vis[a[cnt]]=1;
if ((i/x-i/(x+1))&1) now^=t;
}
for(now = 1; vis[now]; now++);
i > m ? c[1][n/i]=now : c[0][i]=now;
for (j=1; j<=cnt; j++) vis[a[j]]=0;
}
}
void main()
{
scanf("%d",&n);
m = sqrt(n); pre();
int T; scanf("%d",&T);
for (; T--; )
{
int cnt, ans = 0, x; scanf("%d",&cnt);
for(; cnt--; )
{
scanf("%d",&x); x = n / x;
ans ^= ((x > m) ? c[1][n/x] : c[0][x]);
}
ans ? puts("Yes") : puts("No");
}
}
}
int main()
{
runzhe2000::main();
}