Submission #545244

#TimeUsernameProblemLanguageResultExecution timeMemory
545244amunduzbaevStreet Lamps (APIO19_street_lamps)C++17
0 / 100
5052 ms524288 KiB
#include "bits/stdc++.h" using namespace std; #define ar array signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n, q; cin>>n>>q; vector<string> s(q + 1); cin>>s[0]; for(int i=1;i<=q;i++){ s[i] = s[i-1]; string t; cin>>t; if(t == "query"){ int l, r; cin>>l>>r; --l, --r; int res = 0; for(int j=0;j<i;j++){ bool ok = 1; for(int k=l;k<=r;k++){ if(s[j][k] == '0') ok = 0; } res += ok; } cout<<res<<"\n"; } else { int p; cin>>p; p--; s[i][p] = 2 * '1' - s[i][p]; } } }
#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...