Submission #976865

#TimeUsernameProblemLanguageResultExecution timeMemory
976865AIF_is_carvingStreet Lamps (APIO19_street_lamps)C++17
20 / 100
5076 ms524288 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; void solve(){ int n, q; cin>>n>>q; string str[q+1]; cin>>str[0]; for(int i=1; i<=q; i++){ string mark; cin>>mark; if(mark == "toggle"){ int ind; cin>>ind; string s = str[i-1]; if(s[ind-1] == '0') s[ind-1] = '1'; else s[ind-1]='0'; str[i] = s; } else{ int l, r; cin>>l>>r; int ans = 0; for(int j=0; j<=i-1; j++){ int flag =1; for(int k = l-1; k<r-1; k++){ if(str[j][k] == '0') flag = 0; } ans+=flag; } cout<<ans<<"\n"; str[i] =str[i-1]; } } return; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t=1; //cin>>t; while(t--){ solve(); } 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...