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 <bits/stdc++.h>
using namespace std;
int n,q,i,j,ok,x,y;
char sir[300010],op[30];
int mat[110][110];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>q>>(sir+1);
for(i=1; i<=n; i++)
{
ok=1;
for(j=i+1; j<=n+1; j++)
if(sir[j-1]=='0')
break;
else
mat[i][j]++;
}
while(q--)
{
cin>>op>>x;
if(op[0]=='t')
{
if(sir[x]=='0')
sir[x]='1';
else
sir[x]='0';
}
else
{
cin>>y;
cout<<mat[x][y]<<'\n';
}
for(i=1; i<=n; i++)
{
ok=1;
for(j=i+1; j<=n+1; j++)
if(sir[j-1]=='0')
break;
else
mat[i][j]++;
}
}
return 0;
}
# | 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... |