#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
584 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
284 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
0 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Runtime error |
2 ms |
584 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |