#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n, q; cin >> n>> q;
string s; cin >> s;
vector<string> time(q + 1);
time[0] = s;
for (int i = 0; i < q; ++i) {
string t; cin >> t;
string newTime = time[i];
if (t == "toggle") {
int a; cin >> a;
a--;
newTime[a] = newTime[a] == '1' ? '0' : '1';
} else {
int a, b; cin >> a >> b;
a--;
b--;
int ans = 0;
for (int j = 0; j <= i; ++j) {
bool imp = false;
for (int k = a; k <= b; ++k) {
if (time[j][k] == '0') imp = true;
}
if (!imp) ans += 1;
}
cout << ans << "\n";
}
time[i + 1] = newTime;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5064 ms |
19732 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1372 KB |
Output is correct |
2 |
Correct |
23 ms |
1392 KB |
Output is correct |
3 |
Correct |
44 ms |
1360 KB |
Output is correct |
4 |
Correct |
74 ms |
1316 KB |
Output is correct |
5 |
Runtime error |
824 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |