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 N = 3e5 + 10;
int n, q;
string s;
int main(){
cin >> n >> q >> s;
vector<string> vec;
vec.push_back(s);
for (int i = 0; i < q; i ++){
string qx;
cin >> qx;
if (qx[0] == 't'){
int x;
cin >> x;
x--;
s[x] = '1' - s[x] + '0';
}
else{
int a, b;
cin >> a >> b;
a--, b--;
int ans = 0;
for (string x : vec){
bool good = 1;
for (int i = a; i < b; i ++)
if (x[i] == '0')
good = 0;
ans += good;
}
cout << ans << endl;
}
vec.push_back(s);
}
}
# | 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... |