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 <iostream>
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define repa(i,a,b) for(int i = (a); i >= (b); i--)
#define MAX 100
string st;
lli q,n,a,b,res;
lli arr[MAX+2][MAX+2];
bool ya;
int main()
{
ios_base::sync_with_stdio(false);
cin >> n >> q;
cin >> st;
rep(i,0,n-1) arr[0][i+1] = st[i] - '0';
rep(i,1,q) {
cin >> st >> a;
rep(j,1,n) arr[i][j] = arr[i-1][j];
if (st[0] == 't') arr[i][a] ^= 1;
else {
cin >> b;
b--;
res = 0;
rep(t,0,i-1) {
ya = true;
rep(x,a,b) {
if (arr[t][x] == 0) ya = false;
}
if (ya) res++;
}
cout << res << endl;
}
}
}
# | 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... |