Submission #545243

#TimeUsernameProblemLanguageResultExecution timeMemory
545243amunduzbaevStreet Lamps (APIO19_street_lamps)C++17
0 / 100
5084 ms18128 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; s[i][--p] = 2 * '1' - s[i][p]; } } }

Compilation message (stderr)

street_lamps.cpp: In function 'int main()':
street_lamps.cpp:28:9: warning: operation on 'p' may be undefined [-Wsequence-point]
   28 |    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...