​题目传送门​​ 数据随机,随便乱搞

代码:

#include<bits/stdc++.h>
using namespace std;

typedef long long LL;
const int maxn=100000+100;

LL ans[maxn],sum[maxn];

int main(){

int n,q;
scanf("%d%d",&n,&q);
for(int i=1;i<=n;i++) scanf("%lld",&ans[i]),sum[i]=sum[i-1]+ans[i];
while(q--){

int k;
scanf("%d",&k);
if(sum[n]%k || k>n || k<=0) printf("No\n");
else{

LL num=sum[n]/k;
LL now=0;
int i;
for(i=1;i<=k;i++){

LL val= *lower_bound(sum+1,sum+1+n,now+num);
if(val!=now+num) break;
now=now+num;
}
if(i<=k) printf("No\n");
else printf("Yes\n");
}
}
}