# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
852891 | sleepntsheep | Factories (JOI14_factories) | C++17 | 6651 ms | 182868 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 <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <set>
#include <utility>
#include <map>
#include <array>
#include "factories.h"
using namespace std;
#define ALL(x) x.begin(), x.end()
const int N = 500005;
vector<pair<int, int>> g[N];
int tin[N], tout[N], depth[N], timer = 1, P[20][N];
long long root_dis[N];
void dfs(int u, int p, long long ds, int lv)
{
depth[u] = lv;
P[0][u] = p;
for (int j = 1; j < 20; ++j) P[j][u] = P[j-1][P[j-1][u]];
root_dis[u] = ds;
tin[u] = timer++;
for (auto [w, v] : g[u])
if (v != p) dfs(v, u, ds + w, lv+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... |