# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
767765 | Abrar_Al_Samit | Factories (JOI14_factories) | C++17 | 8013 ms | 139984 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 "factories.h"
#include <bits/stdc++.h>
using namespace std;
const int nax = 5e5 + 3;
const int lg = 20;
vector<pair<int, int>>g[nax];
int CT_par[nax];
int st[nax], en[nax], tt = 0;
int up[nax][lg];
long long d[nax];
int sub[nax];
void dfs(int v, int p) {
st[v] = tt++;
up[v][0] = p;
for(int j=1; j<lg; ++j) {
up[v][j] = up[up[v][j-1]][j-1];
}
for(auto [u, w] : g[v]) if(u!=p) {
d[u] = d[v] + w;
dfs(u, v);
}
en[v] = tt-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... |