#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
/*#ifdef ONLINE_JUDGE
freopen("taxi.in", "r", stdin);
freopen("taxi.out", "w", stdout);
#endif
*/
}
int n,q;
string s[305];
string a[300005];
int l[300005],r[300005];
int answer(int l,int r,int ti)
{
int br=0;
for(int i=0;i<ti;i++)
{
for(int j=l;j<=r;j++)
{
if(s[i][j-1]=='0')break;
if(j==r)br++;
}
}
return br;
}
void read()
{
cin>>n>>q>>s[0];
for(int i=1;i<=q;i++)
{
cin>>a[i]>>l[i];
l[i]--;
s[i]=s[i-1];
if(a[i]=="query")
{
cin>>r[i];
r[i]--;
cout<<answer(l[i],r[i],i)<<endl;
}
else
{
s[i][l[i]]++;
if(s[i][l[i]]=='2')s[i][l[i]]='0';
}
}
}
int main()
{
speed();
read();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
24068 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
24668 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
12 ms |
24668 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
9820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |