#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int N,Q;
string s;
cin>>N>>Q>>s;
vector<string> S={};
for(int i=0;i<Q;i++){
S.push_back(s);
string q;
cin>>q;
if(q[0] != 'q'){
int a;
cin>>a;
s[a-1] = '1'-s[a-1]+'0';
continue;
}
int l,r;
cin>>l>>r;
l--;
r--;
int ans = 0;
for(string ss:S){
bool ok = true;
for(int j=l;j<r;j++)if(ss[j] == '0') ok = false;
ans += ok;
}
cout<<ans<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5076 ms |
4136 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1236 KB |
Output is correct |
2 |
Correct |
37 ms |
1268 KB |
Output is correct |
3 |
Correct |
71 ms |
1260 KB |
Output is correct |
4 |
Correct |
139 ms |
1308 KB |
Output is correct |
5 |
Runtime error |
1204 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
116 ms |
1224 KB |
Output is correct |
2 |
Correct |
105 ms |
1220 KB |
Output is correct |
3 |
Correct |
65 ms |
1288 KB |
Output is correct |
4 |
Correct |
6 ms |
1236 KB |
Output is correct |
5 |
Runtime error |
190 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Execution timed out |
5076 ms |
4136 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |