#include<bits/stdc++.h>
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;
constexpr int N=1e5+5;
int n,m,toto,a[N],S,SS,cnt[N],last[N],maxl[N];
char opt[N];
bitset<N>r,p,ans;
struct node{int ls,id,l,r,x;}O[N];
struct Node{int id,l,r;};
vector<Node>C[382];
inline int read(){
char c=getchar();int now=0;
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')now=now*10-'0'+c,c=getchar();
return now;
}inline bool cmp(node x,node y){
if(x.ls!=y.ls)return x.ls<y.ls;
if(x.ls&1)return x.r>y.r;
return x.r<y.r;
}
inline void add(int x){
if(++cnt[a[x]]==1)r.set(a[x]),p.set(N-a[x]);
return;
}inline void del(int x){
if(--cnt[a[x]]==0)r.reset(a[x]),p.reset(N-a[x]);
return;
}
int main(){
n=read(),m=read(),S=sqrt(n)+1;SS=sqrt(N);
for(int i=1;i<=n;i++)a[i]=read();
for(int i=1;i<=m;i++){
opt[i]=read();
int l=read(),r=read(),x=read();
if(opt[i]==4&&x<=SS)C[x].push_back({i,l,r});
else O[++toto]={l/S,i,l,r,x};
}sort(O+1,O+1+toto,cmp);
int L=0,R=0;
for(int i=1;i<=toto;i++){
while(R<O[i].r)add(++R);
while(L>O[i].l)add(--L);
while(L<O[i].l)del(L++);
while(R>O[i].r)del(R--);
if(opt[O[i].id]==1)ans[O[i].id]=(r&(r>>O[i].x))!=0;
else if(opt[O[i].id]==2)ans[O[i].id]=(r&(p>>N-O[i].x))!=0;
else if(opt[O[i].id]==3){
for(int j=1;j*j<=O[i].x;j++)
if(O[i].x%j==0){
int x=j,y=O[i].x/j;
if(x!=y){ if(cnt[x]&&cnt[y]){ans.set(O[i].id);break;} }
else{ if(cnt[x]){ans.set(O[i].id);break;} }
}
}else
for(int j=1;j*O[i].x<=N;j++)
if(cnt[j]&&cnt[j*O[i].x])
{ans.set(O[i].id);break;}
}
for(int x=1;x<=SS;x++){
if(C[x].empty())continue;
int l=0;
for(int i=1;i<=n;i++){
int y=a[i];
last[y]=i;
if(x*y<=N)l=max(l,last[x*y]);
if(y%x==0)l=max(l,last[y/x]);
maxl[i]=l;
}for(auto tx:C[x])ans[tx.id]=(tx.l<=maxl[tx.r]);
for(int i=1;i<=n;i++)last[i]=maxl[i]=0;
}for(int i=1;i<=m;i++)puts(ans[i]?"yuno":"yumi");
return 0;
}
//蒟蒻已经过了小清新人渣的本愿了QWQ
我用SS来表示选中范围上限,即阈值
其中SS=0时TLE on #7,#8,#9,说明我的莫队4操作大概率正确
SS=N时TLE on #1,#2,#3,#7,#8,#9,#10,说明我的暴力4操作也大概率正确
可反常的是
当SS=100时会WA on #2
当SS=50时甚至会多WA一个#7
当SS=100,N=2e5+5时,它甚至还会再多WA一个#10
蒟蒻怀疑是莫队与暴力没有很好分割开来,从而导致了错误,可是实在看不出来QWQ
对拍也拍了几个小时了QWQ
求求了