# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130839 | PeppaPig | Valley (BOI19_valley) | C++14 | 266 ms | 41436 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 <bits/stdc++.h>
#define long long long
#define pii pair<long, long>
#define x first
#define y second
using namespace std;
const int N = 1e5+5;
int n, s, q, e;
int u[N], v[N], w[N], in[N], out[N], pos[N];
int par[N][18], dep[N];
long d[N], dp[N], pre[N][18];
bitset<N> shop;
vector<pii> g[N];
void gen_lca(int u, int p) {
static int idx = 0;
in[u] = ++idx, pos[idx] = u;
dep[u] = dep[p] + 1, par[u][0] = p;
if(shop[u]) dp[u] = d[u];
for(pii v : g[u]) if(v.x != p) {
d[v.x] = d[u] + v.y;
gen_lca(v.x, u);
dp[u] = min(dp[u], dp[v.x]);
}
out[u] = idx;
}
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... |