Submission #1031745

#TimeUsernameProblemLanguageResultExecution timeMemory
1031745stdfloatStreet Lamps (APIO19_street_lamps)C++17
20 / 100
69 ms10980 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<int> cnt(n), l(n); for (int z = 1; z <= q; z++) { string t; cin >> t; if (t == "toggle") { int i; cin >> i; i--; if (s[i] == '0') s[i] = '1'; else { cnt[i] += z - l[i]; s[i] = '0'; } l[i] = z; } else { int a, b; cin >> a >> b; a--; b--; cout << cnt[a] + (s[a] == '1' ? z - l[a] : 0) << '\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...