Submission #383205

#TimeUsernameProblemLanguageResultExecution timeMemory
383205milleniumEeeeStreet Lamps (APIO19_street_lamps)C++17
20 / 100
3 ms516 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[105][105]; // time | string signed main() { fastInp; int n, q; cin >> n >> q; for (int i = 1; i <= n; i++) { cin >> c[0][i]; } string type; for (int xod = 1, tiktak = 1; xod <= q; xod++, tiktak++) { cin >> type; for (int i = 1; i <= n; i++) { c[tiktak][i] = c[tiktak - 1][i]; } if (type == "query") { int l, r; cin >> l >> r; int ans = 0; for (int t = 0; t < tiktak; t++) { bool ok = 1; for (int j = l; j < r; j++) { ok &= (c[t][j] == '1'); } ans += ok; } cout << ans << endl; } if (type == "toggle") { int pos; cin >> pos; c[tiktak][pos] = (c[tiktak][pos] == '1' ? '0' : '1'); } } }
#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...