This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int Q=300050;
int n,q,a,b,ch[Q];
string ipt,tmp;
int main(){
cin>>n>>q;
cin>>ipt;
for (int i=1;i<=q;i++){
cin>>tmp;
if (tmp[0]=='t'){
cin>>a;
ch[i]=a;
}else{
cin>>a>>b;
int ans=0;
tmp=ipt;
for (int j=1;j<=i;j++){
for (int k=a;k<b;k++) if (tmp[k-1]=='0') goto skip;
ans++;
skip:;
if (ch[j]){
if (tmp[ch[j]-1]=='0') tmp[ch[j]-1]='1';
else tmp[ch[j]-1]='0';
}
}
cout<<ans<<"\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |