#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define sz size()
#define ll long long
#define pii pair <int, int>
const int N = 1e4 + 5;
vector <string> v;
int main () {
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// freopen ("input.txt", "r", stdin);
int n, q;
string s;
cin >> n >> q >> s;
while ( q-- ) {
string s1;
cin >> s1;
if (s1 == "query") {
int l, r;
v.pb (s);
cin >> l >> r;
int jog = 0;
// if (q == 0) {
// cout << l - 1 << " " << r - 2 << " " << s << "\n";
//
// for (string i : v) {
// cout << "biz->" << i << "\n";
// }
// return 0;
// }
for (int i = 0; i < (int)v.sz; ++i) {
int tr = 0;
for (int j = l - 1; j < r - 1; ++j) {
if (v[i][j] == '0') tr = 1;
// if (!q) cout << v[i][j];
}
if (!tr) {
jog++;
// if (!q) cout << "gecdi->" << i << "\n";
}
// if (!q)cout << "\n";
}
// if (!q)return 0;
cout << jog << "\n";
}
else {
int l;
cin >> l;
v.pb (s);
if (s[l - 1] == '0') s[l - 1] = '1';
else s[l - 1] = '0';
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5069 ms |
13672 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1368 KB |
Output is correct |
2 |
Correct |
48 ms |
1372 KB |
Output is correct |
3 |
Correct |
68 ms |
1364 KB |
Output is correct |
4 |
Correct |
131 ms |
1452 KB |
Output is correct |
5 |
Runtime error |
1168 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
109 ms |
1248 KB |
Output is correct |
2 |
Correct |
96 ms |
1376 KB |
Output is correct |
3 |
Correct |
67 ms |
1292 KB |
Output is correct |
4 |
Correct |
6 ms |
1372 KB |
Output is correct |
5 |
Runtime error |
199 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
5069 ms |
13672 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |