Submission #1082838

#TimeUsernameProblemLanguageResultExecution timeMemory
1082838boyliguanhanStreet Lamps (APIO19_street_lamps)C++17
20 / 100
6 ms348 KiB
#include<bits/stdc++.h> using namespace std; bitset<101> bt[101]; int main(){ int n,q; cin>>n>>q; for(int i=1;i<=n;i++){ char x; cin>>x; bt[0][i]=x-'0'; } for(int i=1;i<=q;i++){ string str; cin>>str; bt[i]=bt[i-1]; if(str=="toggle"){ int x; cin>>x; bt[i][x]=!bt[i][x]; } else { int a,b; cin>>a>>b; int ans=0; for(int j=0;j<i;j++){ int v=1; for(int k=a;k<b;k++) v&=bt[j][k]; ans+=v; } 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...