Submission #985622

#TimeUsernameProblemLanguageResultExecution timeMemory
985622crafticatStreet Lamps (APIO19_street_lamps)C++17
0 / 100
5032 ms524288 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n>> q; string s; cin >> s; vector<string> time(q + 1); time[0] = s; for (int i = 0; i < q; ++i) { string t; cin >> t; string newTime = time[i]; if (t == "toggle") { int a; cin >> a; a--; newTime[a] = newTime[a] == '1' ? '0' : '1'; } else { int a, b; cin >> a >> b; a--; b--; int ans = 0; for (int j = 0; j <= i; ++j) { bool imp = false; for (int k = a; k <= b; ++k) { if (time[j][k] == '0') imp = true; } if (!imp) ans += 1; } cout << ans << "\n"; } time[i + 1] = newTime; } 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...