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;
using ll = long long;
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n, q;
string s;
cin >> n >> q >> s;
vector<string> v = {s};
while (q--) {
string t;
cin >> t;
if (t == "toggle") {
int i;
cin >> i; i--;
s[i] = '0' + (s[i] == '0');
}
else {
int a, b;
cin >> a >> b; a--; b--;
int cnt = 0;
for (auto i : v) cnt += !count(i.begin() + a, i.begin() + b, '0');
cout << cnt << '\n';
}
v.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... |