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 mxN = 107;
int n, q, cnt[mxN][mxN], arr[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> q;
for (int i = 1; i <= n; ++i) {
char c;
cin >> c;
if (c == '1') {
arr[i] = 1;
}
}
while (q--) {
for (int i = 1; i <= n; ++i) {
for (int j = i+1; j <= n+1; ++j) {
if (!arr[j-1]) {
break;
}
cnt[i][j]++;
}
}
string t;
cin >> t;
if (t[0] == 'q') {
int a, b;
cin >> a >> b;
cout << cnt[a][b] << "\n";
}
else {
int ind;
cin >> ind;
arr[ind] ^= 1;
}
}
}
# | 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... |