https://ac.nowcoder.com/acm/contest/76609/F
这道题我代码的思路应该是错的,但我不明白我哪里想错了,样例能过。求助
include[HTML_REMOVED]
using namespace std;
typedef long long ll;
ll n,q;
string s;
ll mo(ll l,ll r)
{
if(l==r) return 0;
ll i=l;
ll j=r;
while(i<j)
{
if(s[i]!=s[j])
{
return 0;
}
i++;
j--;
}
return 1;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>q;
cin>>s;
s=” “+s;
while(q–)
{
int x;
cin>>x;
if(x==1)
{
int p;
cin>>p;
char ch;
cin>>ch;
s[p]=ch;
continue;
}
else if(x==2)
{
ll l,r;
cin>>l>>r;
cout<<mo(l,r)<<endl;
continue;
}
}
return 0;
}