#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define trav(a,v) for(auto a:v)
int main(){
int n,q;
cin>>n>>q;
string state;
cin>>state;
vector<string> V;
V.push_back(state);
while(q--){
string type;
cin>>type;
if(type=="query"){
int x,y;
cin>>x>>y;
x--;
y-=2;
int ans=0;
trav(a,V){
bool b=true;
rep(i,x,y+1){
if(a[i]=='0')b=false;
}
ans+=b;
//cout<<a<<" "<<a[x]<<endl;
}
cout<<ans<<endl;
}else{
int x;
cin>>x;
x--;
state[x]='0'+'1'-state[x];
}
V.push_back(state);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5006 ms |
3816 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1400 KB |
Output is correct |
2 |
Correct |
57 ms |
1540 KB |
Output is correct |
3 |
Correct |
109 ms |
1356 KB |
Output is correct |
4 |
Correct |
179 ms |
1528 KB |
Output is correct |
5 |
Runtime error |
2412 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
183 ms |
1400 KB |
Output is correct |
2 |
Correct |
160 ms |
1476 KB |
Output is correct |
3 |
Correct |
104 ms |
1412 KB |
Output is correct |
4 |
Correct |
11 ms |
1400 KB |
Output is correct |
5 |
Runtime error |
446 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
376 KB |
Output is correct |
8 |
Execution timed out |
5006 ms |
3816 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |