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;
const int nmax = 100;
int n,q;
int s[nmax + 5][nmax + 5];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>q;
for(int i=1;i<=n;i++)
{
char ch;
cin>>ch;
s[1][i] = ch - '0';
}
for(int i=1;i<=q;i++)
{
string tip;
cin>>tip;
for(int j=1;j<=n;j++)
{
s[i + 1][j] = s[i][j];
}
if(tip == "query")
{
int a,b;
cin>>a>>b;
--b;
int rez = 0;
for(int t=1;t<=i;t++)
{
bool ok = true;
for(int j=a;j<=b;j++)
{
if(s[t][j] != 1)
{
ok = false;
}
}
rez += ok;
}
cout<<rez<<'\n';
}
else
{
int poz;
cin>>poz;
if(s[i + 1][poz] == 0)
{
s[i + 1][poz] = 1;
}
else
{
s[i + 1][poz] = 0;
}
}
}
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... |