#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n, q;
string s;
int main(){
cin >> n >> q >> s;
vector<string> vec;
vec.push_back(s);
for (int i = 0; i < q; i ++){
string qx;
cin >> qx;
if (qx[0] == 't'){
int x;
cin >> x;
x--;
s[x] = '1' - s[x] + '0';
}
else{
int a, b;
cin >> a >> b;
a--, b--;
int ans = 0;
for (string x : vec){
bool good = 1;
for (int i = a; i < b; i ++)
if (x[i] == '0')
good = 0;
ans += good;
}
cout << ans << endl;
}
vec.push_back(s);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5064 ms |
6156 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
Output is correct |
2 |
Correct |
28 ms |
1312 KB |
Output is correct |
3 |
Correct |
45 ms |
1372 KB |
Output is correct |
4 |
Correct |
79 ms |
1424 KB |
Output is correct |
5 |
Runtime error |
957 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
1360 KB |
Output is correct |
2 |
Correct |
71 ms |
1412 KB |
Output is correct |
3 |
Correct |
45 ms |
1332 KB |
Output is correct |
4 |
Correct |
5 ms |
1372 KB |
Output is correct |
5 |
Runtime error |
245 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Execution timed out |
5064 ms |
6156 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |