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 <iostream>
using namespace std;
int N,Q;
string S;
bool A[300001];
int Ans[300001];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>N>>Q>>S;
for (int i=1; i<=N; i++)
A[i]=(S[i-1]=='1');
for (int t=1; t<=Q; t++){
string s;
cin>>s;
if (s[0]=='t'){
int x;
cin>>x;
if (A[x])
Ans[x]+=t;
else
Ans[x]-=t;
A[x]^=true;
}
else{
int l,r;
cin>>l>>r;
cout<<Ans[l]+(A[l]?t:0)<<"\n";
}
}
return 0;
}
# | 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... |