#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin() , x.end()
#define sze(x) (ll)(x.size())
typedef long long ll;
typedef pair<ll , ll> pll;
const ll maxn = 3e5 + 16 , inf = 2e18;
ll n , q;
string s;
vector<ll> qu;
void sub1(){
bitset<102> a[102];
for(ll i = 0 ; i < n ; i++){
a[0][i] = (s[i] == '1');
}
for(ll i = 1 ; i <= q ; i++){
string t;
cin>>t;
if(t[0] == 'q'){
a[i] = a[i - 1];
ll l , r;
cin>>l>>r; l--; r--;
ll ans = 0;
for(ll j = 0 ; j < i ; j++){
bool ch = true;
for(ll k = l ; k < r ; k++){
ch &= a[j][k];
}
ans += ch;
}
cout<<ans<<'\n';
} else {
ll j;
cin>>j; j--;
a[i] = a[i - 1];
a[i][j] = a[i][j] ^ 1;
}
}
return;
}
int main(){
ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0);
cin>>n>>q>>s;
if(n <= 1e2 && q <= 1e2){
sub1();
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 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 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 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 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |