Submission #1031735

#TimeUsernameProblemLanguageResultExecution timeMemory
1031735stdfloatStreet Lamps (APIO19_street_lamps)C++17
20 / 100
5030 ms524288 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, q; string s; cin >> n >> q >> s; vector<string> v = {s}; while (q--) { string t; cin >> t; if (t == "toggle") { int i; cin >> i; i--; s[i] = '0' + (s[i] == '0'); } else { int a, b; cin >> a >> b; a--; b--; int cnt = 0; for (auto i : v) cnt += !count(i.begin() + a, i.begin() + b, '0'); cout << cnt << '\n'; } v.push_back(s); } }
#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...