#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<cstring>
#include<map>
#include<bitset>
#include<set>
using namespace std;
#define LL long long
#define PLL pair<LL,LL>
#define INF 1e18
#define eps 1e-6
#define DB double
#define N 200010
LL n,m;
LL d[N],c[N][3],OP[N];
char a[N];
LL lowbit(LL x)
{
return x & -x;
}
void add(LL l,LL w,LL ty)
{
for(int i=l;i<=n;i+=lowbit(i))c[i][ty]+=w;
}
LL sum(LL l,LL ty)
{
LL ans=0;
for(int i=l;i;i-=lowbit(i))ans+=c[i][ty];
return ans;
}
void check(LL x)
{
if(x<1 || x>n)return ;
LL cnt=0;
add(x,-OP[x],1);
OP[x]=0;
if(x+1<=n)
{
if(sum(x,2)%26==sum(x+1,2)%26)cnt++;
}
if(x+2<=n)
{
if(sum(x,2)%26==sum(x+2,2)%26)cnt++;
}
add(x,cnt,1);
OP[x]=cnt;
}
void solve()
{
cin>>n>>m>>a+1;
for(int i=1;i<=n;i++)
{
c[i][1]=c[i][2]=OP[i]=0;
}
LL ssum=0;
for(int i=1;i<=n;i++)
{
LL tem=a[i]-'a';
tem-=ssum;
add(i,tem,2);
ssum+=tem;
}
for(int i=1;i<=n;i++)check(i);
for(int i=1;i<=m;i++)
{
LL op,l,r,x;
cin>>op>>l>>r;
if(op==1)cin>>x;
if(op==1)
{
add(l,x,2);
add(r+1,-x,2);
check(l-2);check(l-1);
check(r-1);check(r);
}
else
{
LL ans=0;
if(r-2>=l)ans+=sum(r-2,1)-sum(l-1,1);
if(r-1>=l && sum(r-1,2)%26==sum(r,2)%26)ans++;
if(ans==0)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
}
int main()
{
//init();
LL t=1;
cin>>t;
while(t--)solve();
return 0;
}
1472B - Fair Division | 1281C - Cut and Paste |
141A - Amusing Joke | 112A - Petya and Strings |
677A - Vanya and Fence | 1621A - Stable Arrangement of Rooks |
472A - Design Tutorial Learn from Math | 1368A - C+= |
450A - Jzzhu and Children | 546A - Soldier and Bananas |
32B - Borze | 1651B - Prove Him Wrong |
381A - Sereja and Dima | 41A - Translation |
1559A - Mocha and Math | 832A - Sasha and Sticks |
292B - Network Topology | 1339A - Filling Diamonds |
910A - The Way to Home | 617A - Elephant |
48A - Rock-paper-scissors | 294A - Shaass and Oskols |
1213A - Chips Moving | 490A - Team Olympiad |
233A - Perfect Permutation | 1360A - Minimal Square |
467A - George and Accommodation | 893C - Rumor |
227B - Effective Approach | 1534B - Histogram Ugliness |