| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364289 | kawhiet | 가로등 (APIO19_street_lamps) | C++20 | 5092 ms | 589824 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, q;
string s;
cin >> n >> q >> s;
vector<int> a(n);
for (int i = 0; i < n; i++) {
a[i] = s[i] - '0';
}
vector<vector<int>> b = {a};
while (q--) {
string t;
cin >> t;
if (t == "toggle") {
int i;
cin >> i;
a[--i] ^= 1;
} else {
int l, r;
cin >> l >> r;
l--; r--;
int res = 0;
for (int i = 0; i < b.size(); i++) {
vector<int> x = b[i];
bool ok = true;
for (int i = l; i < r; i++) {
if (x[i] == 0) {
ok = false;
}
}
if (ok) {
res++;
}
}
cout << res << '\n';
}
b.push_back(a);
}
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
