#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
int n, q;
string v[MAXN];
int main()
{
cin >> n >> q;
cin >> v[1];
for(int i = 1 ; i <= q ; i++)
{
string type;
cin >> type;
v[i + 1] = v[i];
if( type == "toggle" )
{
int ind;
cin >> ind; ind--;
v[i + 1][ind] = '1' - v[i][ind];
}
if( type == "query" )
{
int l, r;
cin >> l >> r; l--; r--;
int ans = 0;
for(int t = 1 ; t <= i ; t++)
{
bool flag = true;
for(int j = l ; j < r ; j++)
if( v[t][j] == '0' ) flag = false;
if( flag ) ans++;
}
printf("%d\n",ans);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |