不知道开头是什么意思😅 废话不多说,上代码:
#include<bits/stdc++.h>
#define ll long long
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
ll c[32],T,n,k,S,x;
int i,j,y,b[32],ans[10];
char buf[1<<21],*p1=buf,*p2=buf;
int SG(ll s)
{
int k=65-__builtin_clzll(9*s)>>1;
return int(sqrt(4*s+c[k]))-k>>1;
}
ll read()
{
ll s=0;
char cc=getchar();
while(cc<'0' || cc>'9')
cc=getchar();
while(cc>='0' && cc<='9')
{
s=s*10+cc-'0';
cc=getchar();
}
return s;
}
int main()
{
for(i=1;i<32;i++)
c[i]=(1ll<<(i+2))/3-1;
T=read();
for(i=0;i<T;i++)
{
n=read(),k=read()+1,S=read();
for(j=0;j<n;j++)
{
x=SG(read());
while(x)
{
b[y]+=x&1;
x>>=1;
y++;
}
y=0;
}
for(j=0;j<32;j++)
{
if(b[j]%k)
ans[i]=1;
b[j]=0;
}
puts(ans[i]?"YES":"NO");
}
}//是C++代码,别弄错了。 不AC来揍我。电话:13956218168 可能有时候关机。希望大慈大悲的管理员给过。