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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, q; cin >> n >> q;
vector<vector<int>> v(1, vector<int>(n));
for(int &x: v[0]){
char c; cin >> c; x = c-'0';
}
while(q--){
v.pb(v.back());
str tt; cin >> tt;
if(tt == "toggle"){
int in; cin >> in; in--;
v.back()[in] = !v.back()[in];
}
else{
int a, b; cin >> a >> b; a--, b-=2;
int cnt = 0;
for(int i = 0; i < (int)v.size() - 1; i++){
bool bl = 1;
for(int j = a; j <= b; j++) if(!v[i][j]) bl = 0;
if(bl) cnt++;
}
cout << cnt << "\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... |