# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916630 | duckindog | Street Lamps (APIO19_street_lamps) | C++14 | 2 ms | 856 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//from duckindog wth depression
#include<bits/stdc++.h>
using namespace std;
const int N = 100 + 10;
int n, q;
string s[N];
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
if (fopen("duck.inp", "r")) {
freopen("duck.inp", "r", stdin);
freopen("duck.out", "w", stdout);
}
cin >> n >> q;
cin >> s[1];
for (int i = 1; i <= q; ++i) {
s[i + 1] = s[i];
string ty; cin >> ty;
if (ty == "toggle") {
int p; cin >> p;
s[i + 1][p - 1] = (s[i + 1][p - 1] == '0' ? '1' : '0');
} else {
int a, b; cin >> a >> b;
int answer = 0;
for (int j = 1; j <= i; ++j) {
bool pass = 1;
for (int t = a - 1; t < b - 1; ++t)
if (s[j][t] == '0') pass = 0;
answer += pass;
}
cout << answer << '\n';
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |