Submission #405509

#TimeUsernameProblemLanguageResultExecution timeMemory
405509Jarif_RahmanStreet Lamps (APIO19_street_lamps)C++17
20 / 100
5100 ms524292 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; vector<vector<int>> v(1, vector<int>(n)); for(int &x: v[0]){ char c; cin >> c; x = c-'0'; } while(q--){ v.pb(v.back()); str tt; cin >> tt; if(tt == "toggle"){ int in; cin >> in; in--; v.back()[in] = !v.back()[in]; } else{ int a, b; cin >> a >> b; a--, b-=2; int cnt = 0; for(int i = 0; i < (int)v.size() - 1; i++){ bool bl = 1; for(int j = a; j <= b; j++) if(!v[i][j]) bl = 0; if(bl) cnt++; } cout << cnt << "\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...