题解 | #回文串#
相遇
https://ac.nowcoder.com/acm/contest/83687/A
#include<bits/stdc++.h>
using namespace std;
int main(){
int len;
int n;
char c[200005];
cin>>len>>n;
for(int i = 0; i < len; i++){
cin>>c[i];
}
for(int i = 0; i < n; i++){
int type;
int l;
int r;
char ch;
cin>>type;
if(type == 1){
cin>>l>>r;
if(r - l <= 2) cout<<"YES"<<endl;
else{
int time = 0;
l--;
r--;
while(l < r){
if(c[l] != c[r]){
time++;
}
l++;
r--;
if(time > 1) break;
}
if(time > 1) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
}else{
cin>>l>>r>>ch;
l--;
while(l < r){
c[l++] = ch;
}
}
}
return 0;
}