Submission #1044930

#TimeUsernameProblemLanguageResultExecution timeMemory
1044930vjudge1Street Lamps (APIO19_street_lamps)C++17
20 / 100
5089 ms524288 KiB
#include <bits/stdc++.h> #define fast cin.tie(0)->sync_with_stdio(0); #define int long long #define inf ((int)1e18) using namespace std; int32_t main(){ fast int n, q; cin >> n >> q; string s; cin >> s; vector <string> states; states.push_back(s); while(q--) { string t; cin >> t; if(t == "query") { int a, b, ans = 0; cin >> a >> b; for(auto it:states) { bool yes = 1; for(int i = a - 1; i < b - 1; i++) { if(it[i] != '1') { yes = 0; break; } } ans += yes; } states.push_back(states.back()); cout << ans << "\n"; } else { int ind; cin >> ind; string p = states.back(); p[ind - 1] = (p[ind - 1] - '0' + 1) % 2 + '0'; states.push_back(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...