#include <bits/stdc++.h>
using namespace std;
long long n, q, nom, it, flag, a, b, res;
string s[107], r;
int main()
{
cin>>n>>q;
cin>>s[0];
s[0]='&'+s[0];
nom=0;
while(q--)
{
cin>>r;
if(r[0]=='t')
{
cin>>it;
nom++;
s[nom]=s[nom-1];
if(s[nom][it]=='0') s[nom][it]='1';
else s[nom][it]='0';
continue;
}
cin>>a>>b;
res=0;
for(int k=0; k<=nom; k++)
{
flag=0;
for(int i=a; i<b; i++)
{
if(s[k][i]=='0')
{
flag=1;
break;
}
}
if(flag==0) res++;
}
nom++;
s[nom]=s[nom-1];
cout<<res<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
436 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
588 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
588 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Runtime error |
1 ms |
436 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |