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;
#define ar array
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n, q; cin>>n>>q;
vector<string> s(q + 1);
cin>>s[0];
for(int i=1;i<=q;i++){
s[i] = s[i-1];
string t; cin>>t;
if(t == "query"){
int l, r; cin>>l>>r;
--l, --r;
int res = 0;
for(int j=0;j<i;j++){ bool ok = 1;
for(int k=l;k<=r;k++){
if(s[j][k] == '0') ok = 0;
} res += ok;
}
cout<<res<<"\n";
} else {
int p; cin>>p; p--;
s[i][p] = 2 * '1' - s[i][p];
}
}
}
# | 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... |