Submission #865877

#TimeUsernameProblemLanguageResultExecution timeMemory
865877jk410Street Lamps (APIO19_street_lamps)C++17
20 / 100
81 ms9312 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...