#include<bits/stdc++.h>
using namespace std;
const int N=300050;
int n,q,a,b,ch[N],curr[N],lst[N];
string ipt,tmp;
int main(){
cin>>n>>q;
cin>>ipt;
for (int i=1;i<=q;i++){
cin>>tmp;
if (tmp[0]=='t'){
cin>>a;
ch[i]=a;
if (ipt[a-1]=='0'){
lst[a]=i;
ipt[a-1]='1';
}else{
curr[a]+=i-lst[a];
ipt[a-1]='0';
}
}else{
cin>>a>>b;
if (ipt[a-1]=='1') cout<<i-lst[a]+curr[a]<<"\n";
else cout<<curr[a]<<"\n";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
341 ms |
4792 KB |
Output is correct |
2 |
Correct |
353 ms |
5812 KB |
Output is correct |
3 |
Correct |
367 ms |
6460 KB |
Output is correct |
4 |
Correct |
405 ms |
10036 KB |
Output is correct |
5 |
Correct |
442 ms |
9340 KB |
Output is correct |
6 |
Correct |
378 ms |
9404 KB |
Output is correct |
7 |
Correct |
646 ms |
7228 KB |
Output is correct |
8 |
Correct |
698 ms |
8600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |