# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819612 | aryan12 | Valley (BOI19_valley) | C++17 | 130 ms | 57336 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>
using namespace std;
#define int long long
const int N = 1e5 + 5, LG = 17, INF = 1e18;
vector<pair<int, int> > g[N];
bool shop[N];
int lift[LG][N], tin[N], tout[N], tim = 0;
int dist_in_subtree[N];
int bestup[LG][N], tot_dist[LG][N];
void dfs(int node, int par)
{
if(shop[node])
{
dist_in_subtree[node] = 0;
}
else
{
dist_in_subtree[node] = INF;
}
tin[node] = ++tim;
lift[0][node] = par;
for(auto [to, wt]: g[node])
{
if(to == par) continue;
dfs(to, node);
tot_dist[0][to] = wt;
dist_in_subtree[node] = min(dist_in_subtree[node], dist_in_subtree[to] + wt);
bestup[0][to] = min(dist_in_subtree[to], dist_in_subtree[node] + wt);
# | 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... |