Submission #597517

#TimeUsernameProblemLanguageResultExecution timeMemory
597517WongChun1234Street Lamps (APIO19_street_lamps)C++14
20 / 100
698 ms10036 KiB
#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 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...