#include "bits/stdc++.h"
using namespace std;
#define int long long
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define pii pair<int, int>
const int N = 105;
const int mod = 1e9+7;
int n, m, k, a[N];
int rr[N][N];
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>m;
string s; cin>>s;
for(int i=0;i<n;i++) a[i] = s[i] - '0';
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
int l = j;
while(l < n && a[l]) rr[j][l]++, l++;
} cin>>s;
if(s == "query"){
int a, b; cin>>a>>b, a--, b-=2;
cout<<rr[a][b]<<"\n";
} else {
int in; cin>>in, in--;
a[in] ^= 1;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
255 ms |
4424 KB |
Output is correct |
2 |
Runtime error |
1 ms |
588 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
316 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
255 ms |
4424 KB |
Output is correct |
9 |
Runtime error |
1 ms |
588 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |