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;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int N, Q;
string S;
cin >> N >> Q >> S;
vector<string> states = {S};
while (Q--) {
string T;
cin >> T;
if (T == "toggle") {
int P;
cin >> P;
P--;
S[P] ^= 1;
} else {
int L, R;
cin >> L >> R;
L--, R--;
int ans = 0;
for (auto value : states) {
ans += value.substr(L, R - L) == string(R - L, '1');
}
cout << ans << "\n";
}
states.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... |