#include <bits/stdc++.h>
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, q;
std::cin >> n >> q;
std::vector<std::string> v(1);
std::cin >> v[0];
while (q--) {
std::string type;
std::cin >> type;
std::string toadd = v.back();
if (type == "query") {
int l, r;
std::cin >> l >> r;
l--;
r-=2;
int res = 0;
for (auto &x : v) {
if (std::accumulate(x.begin() + l, x.begin() + r + 1, 0) - '0' * (r - l + 1) == r - l + 1) {
res++;
}
}
std::cout << res << '\n';
} else {
int p;
std::cin >> p;
p--;
toadd[p] ^= 1;
}
v.push_back(toadd);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5058 ms |
12772 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1356 KB |
Output is correct |
2 |
Correct |
57 ms |
1348 KB |
Output is correct |
3 |
Correct |
115 ms |
1256 KB |
Output is correct |
4 |
Correct |
190 ms |
1276 KB |
Output is correct |
5 |
Runtime error |
1799 ms |
524292 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
186 ms |
1368 KB |
Output is correct |
2 |
Correct |
167 ms |
1344 KB |
Output is correct |
3 |
Correct |
104 ms |
1336 KB |
Output is correct |
4 |
Correct |
10 ms |
1368 KB |
Output is correct |
5 |
Runtime error |
265 ms |
524292 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Execution timed out |
5058 ms |
12772 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |