#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define sz(x) (int)x.size()
#define ff first
#define ss second
const ll N = 305;
const ll M = 1e9 + 7;
int T, n, q;
string s[N];
int main(){
ios::sync_with_stdio(false); cin.tie(0);
cin >> n >> q >> s[0];
for(int i = 1; i <= q; i++){
string s1;
cin >> s1;
s[i] = s[i-1];
if(s1 == "toggle"){
int ind;
cin >> ind;
ind--;
if(s[i][ind] == '1') s[i][ind] = '0';
else s[i][ind] = '1';
}
else {
int a, b, ans = 0;
cin >> a >> b;
for(int j = 0; j <= i-1; j++){
bool tr = 0;
for(int k = a-1; k < b; k++){
if(s[j][k] == '0'){
tr = 1;
break;
}
}
ans += (tr == 0);
}
cout << ans << '\n';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |