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 v[105][105],n,q,x,y,i,j,t;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>n>>q;
for (i=1;i<=n;i++)
{
char ch;
cin>>ch;
v[i][0]=ch-'0';
}
for (i=1;i<=q;i++)
{
char tip[15];
cin>>tip;
if (strcmp(tip,"query")==0)
{
cin>>x>>y;
for (j=1;j<=n;j++)
{
v[j][i]=v[j][i-1];
}
int ok=0;
for (j=0;j<i;j++)
{
int sum=0;
for (t=x;t<y;t++)
{
sum=sum+v[t][j];
}
if (sum==y-x)
{
ok++;
}
}
cout<<ok<<'\n';
}
else
{
cin>>x;
for (j=1;j<=n;j++)
{
v[j][i]=v[j][i-1];
}
v[x][i]=1-v[x][i];
}
}
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... |