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;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
int main(){
int n,q;
cin>>n>>q;
string state;
cin>>state;
vector<string> V;
V.push_back(state);
while(q--){
string type;
cin>>type;
if(type=="query"){
int x,y;
cin>>x>>y;
x--;
y-=2;
int ans=0;
trav(a,V){
bool b=true;
rep(i,x,y+1){
if(a[i]=='0')b=false;
}
ans+=b;
//cout<<a<<" "<<a[x]<<endl;
}
cout<<ans<<endl;
}else{
int x;
cin>>x;
x--;
state[x]='0'+'1'-state[x];
}
V.push_back(state);
}
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... |