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 <iostream>
using namespace std;
int ans[110][110];
string s;
int f(int i,int j)
{
for(int k=i;k<j;k++)
{
if(s[k]=='0')
return 0;
}
return 1;
}
int main()
{
int n,m;
cin>>n>>m;
//string s;
cin>>s;
while(m--)
{for(int i=0;i<n;i++)
{
for(int j=i+1;j<=n;j++)
{
if(f(i,j))
ans[i][j]++;
}
}
string c;
cin>>c;
if(c[0]=='q')
{
int a,b;
cin>>a>>b;
a--;
b--;
cout<<ans[a][b]<<endl;
}
else
{
int i;
cin>>i;
i--;
if(s[i]=='1')
s[i]='0';
else s[i]='1';
}
}
}
# | 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... |