Submission #597514

#TimeUsernameProblemLanguageResultExecution timeMemory
597514WongChun1234Street Lamps (APIO19_street_lamps)C++14
20 / 100
5068 ms6424 KiB
#include<bits/stdc++.h> using namespace std; const int Q=300050; int n,q,a,b,ch[Q]; 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; }else{ cin>>a>>b; int ans=0; tmp=ipt; for (int j=1;j<=i;j++){ for (int k=a;k<b;k++) if (tmp[k-1]=='0') goto skip; ans++; skip:; if (ch[j]){ if (tmp[ch[j]-1]=='0') tmp[ch[j]-1]='1'; else tmp[ch[j]-1]='0'; } } cout<<ans<<"\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...