#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,tes,t,f[300009],pas;
pair <string, pair <int, int> > p[300009];
string S;
int els(int q){
if(q==0) return 1; else return 0;
}
int main(){
ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>tes;
cin>>S;
S.insert(0,"0");
p[0].first="W";
for(i=1; i<=a; i++){
f[i]=S[i]-'0';
}
a++;
for(t=1; t<=tes; t++){
cin>>p[t].first;
if(p[t].first[0]=='q'){
cin>>p[t].second.first>>p[t].second.second;
}else{
cin>>p[t].second.first;
}
}
if(a<=102&&tes<=102){
for(i=1; i<=tes; i++){
if(p[i].first[0]=='t'){
f[p[i].second.first]=els(f[p[i].second.first]);
continue;
}
pas=0;
for(ii=i-1; ii>=0; ii--){
for(j=p[i].second.first; j<p[i].second.second; j++){
if(f[j]==0) break;
}
if(j==p[i].second.second){
pas++;
}
if(p[ii].first[0]=='t'){
f[p[ii].second.first]=els(f[p[ii].second.first]);
}
}
for(ii=1; ii<=i-1; ii++){
if(p[ii].first[0]=='t'){
f[p[ii].second.first]=els(f[p[ii].second.first]);
}
}
cout<<pas<<endl;
}
exit(0);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
11980 KB |
Output is correct |
2 |
Correct |
7 ms |
12064 KB |
Output is correct |
3 |
Correct |
7 ms |
11980 KB |
Output is correct |
4 |
Correct |
7 ms |
11980 KB |
Output is correct |
5 |
Correct |
7 ms |
12060 KB |
Output is correct |
6 |
Correct |
7 ms |
11980 KB |
Output is correct |
7 |
Correct |
7 ms |
12068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
66 ms |
15300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
12092 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
12080 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
11980 KB |
Output is correct |
2 |
Correct |
7 ms |
12064 KB |
Output is correct |
3 |
Correct |
7 ms |
11980 KB |
Output is correct |
4 |
Correct |
7 ms |
11980 KB |
Output is correct |
5 |
Correct |
7 ms |
12060 KB |
Output is correct |
6 |
Correct |
7 ms |
11980 KB |
Output is correct |
7 |
Correct |
7 ms |
12068 KB |
Output is correct |
8 |
Incorrect |
66 ms |
15300 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |