Submission #207825

#TimeUsernameProblemLanguageResultExecution timeMemory
207825SegtreeStreet Lamps (APIO19_street_lamps)C++14
20 / 100
8 ms788 KiB
#include<iostream> #include<algorithm> #include<vector> #include<queue> #include<set> #include<unordered_set> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<n;i++) #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define all(x) x.begin(),x.end() ll n,q; string s[110]; int main(){ cin>>n>>q; cin>>s[0]; for(int t=1;t<=q;t++){ s[t]=s[t-1]; string typ; cin>>typ; if(typ=="query"){ ll a,b; cin>>a>>b; a--,b--; ll ans=0; for(int i=0;i<t;i++){ ll cnt=0; for(int j=a;j<b;j++){ if(s[i][j]=='0')cnt++; } ans+=(cnt==0); } cout<<ans<<endl; } if(typ=="toggle"){ ll x; cin>>x; x--; if(s[t][x]=='0')s[t][x]='1'; else s[t][x]='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...