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;
bitset<101> bt[101];
int main(){
int n,q;
cin>>n>>q;
for(int i=1;i<=n;i++){
char x;
cin>>x;
bt[0][i]=x-'0';
}
for(int i=1;i<=q;i++){
string str;
cin>>str;
bt[i]=bt[i-1];
if(str=="toggle"){
int x;
cin>>x;
bt[i][x]=!bt[i][x];
} else {
int a,b;
cin>>a>>b;
int ans=0;
for(int j=0;j<i;j++){
int v=1;
for(int k=a;k<b;k++)
v&=bt[j][k];
ans+=v;
}
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... |