This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |