# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150395 | JeffreyHo (#200) | Bulb Game (FXCUP4_bulb) | C++17 | 2 ms | 380 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.
#include "bulb.h"
using namespace std;
int l[300005], r[300005], c[300005], d[300005], e[300005], f[300005], o;
int t[600005], z;
int que(int l, int r) {
int z = 890328;
for (l += o, r += o; l < r; l >>= 1, r >>= 1) {
if (l & 1) z = min(z, t[l++]);
if (r & 1) z = min(z, t[--r]);
}
return z;
}
void dfs(int x) {
d[x] = o;
if (l[x] >= 0) c[l[x]] = c[x], dfs(l[x]);
if (l[x] == -2) f[o++] = c[x];
if (r[x] >= 0) c[r[x]] = c[x] + 1, dfs(r[x]);
if (r[x] == -2) f[o++] = c[x] + 1;
e[x] = o;
}
void dfs2(int x) {
if (r[x] >= 0) {
if (que(0, d[x]) >= 2 && que(d[x], e[x]) >= 1 && que(d[r[x]], e[r[x]]) >= 3 && que(e[x], o) >= 2) z = 1;
} else {
if ((c[x] >= 3 || r[x] == -1) && que(0, d[x]) >= 2 && que(d[x], e[x]) >= 1 && que(e[x], o) >= 2) z = 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |