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;
#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
cin >> n >> q;
string s;
cin >> s;
vector<map<int, int>> mp(n);
while (q--) {
string qs;
cin >> qs;
for (int i = 0; i < n; ++i) {
for (int j = i; j < n; ++j) {
if (s[j] == '0') break;
mp[i][j + 1]++;
}
}
if (qs == "query") {
int l, r;
cin >> l >> r;
--l, --r;
cout << mp[l][r] << '\n';
} else {
int i;
cin >> i;
s[i - 1] ^= 1;
}
}
return 0;
}
# | 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... |