Submission #383208

#TimeUsernameProblemLanguageResultExecution timeMemory
383208milleniumEeee가로등 (APIO19_street_lamps)C++17
0 / 100
5089 ms5276 KiB
#include <bits/stdc++.h> #define fastInp ios_base::sync_with_stdio(0); cin.tie(0); #define pii pair<int, int> #define fr first #define sc second #define mk make_pair #define pb push_back #define szof(s) (int)s.size() #define all(s) s.begin(), s.end() using namespace std; const int MAXN = (int)3e5 + 5; char c[MAXN]; int pref[MAXN]; signed main() { fastInp; int n, q; cin >> n >> q; for (int i = 1; i <= n; i++) { cin >> c[i]; pref[i] = (c[i] == '1'); } string type; for (int xod = 1, tiktak = 1; xod <= q; xod++, tiktak++) { cin >> type; if (type == "query") { int l, r; cin >> l >> r; assert(l + 1 == r); cout << pref[l] << endl; } if (type == "toggle") { int pos; cin >> pos; c[pos] = (c[pos] == '1' ? '0' : '1'); } for (int i = 1; i <= n; i++) { if (c[i] == '1') { pref[i]++; } } } }
#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...