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 <iostream>
using namespace std;
int N,Q;
string S;
bool A[101][101];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>N>>Q>>S;
for (int i=1; i<=N; i++)
A[0][i]=(S[i-1]=='1');
for (int t=1; t<=Q; t++){
for (int i=1; i<=N; i++)
A[t][i]=A[t-1][i];
string s;
cin>>s;
if (s[0]=='t'){
int x;
cin>>x;
A[t][x]^=true;
}
else{
int l,r;
cin>>l>>r;
int cnt=0;
for (int i=0; i<t; i++){
bool flag=true;
for (int j=l; j<r; j++)
flag&=A[i][j];
cnt+=flag;
}
cout<<cnt<<"\n";
}
}
return 0;
}
# | 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... |