Submission #136667

#TimeUsernameProblemLanguageResultExecution timeMemory
136667KLPPStreet Lamps (APIO19_street_lamps)C++14
20 / 100
5006 ms524292 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int lld; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) int main(){ int n,q; cin>>n>>q; string state; cin>>state; vector<string> V; V.push_back(state); while(q--){ string type; cin>>type; if(type=="query"){ int x,y; cin>>x>>y; x--; y-=2; int ans=0; trav(a,V){ bool b=true; rep(i,x,y+1){ if(a[i]=='0')b=false; } ans+=b; //cout<<a<<" "<<a[x]<<endl; } cout<<ans<<endl; }else{ int x; cin>>x; x--; state[x]='0'+'1'-state[x]; } V.push_back(state); } 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...