# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52234 | ics0503 | Factories (JOI14_factories) | C++17 | 6914 ms | 228692 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<vector>
#include<algorithm>
using namespace std;
struct xy { long long x, y; };
struct gg { int w, s, e; };
bool sort_y(xy a, xy b) {
if (a.y != b.y)return a.y < b.y;
return a.x < b.x;
}
vector<xy>edge[515151];
long long W[515151], ST[515151],EN[515151], Dist[515151], Depth[515151], cnt = 0;
long long par[515151][21];
bool sort_st(long long a, long long b) {
if (ST[a] != ST[b])return ST[a] < ST[b];
return EN[a] > EN[b];
}
void dfs(long long w, long long bef,long long depth,long long dist) {
Depth[w] = depth;
Dist[w] = dist;
ST[w] = cnt; W[w] = cnt++;
par[w][0] = bef;
for (long long i = 0; par[w][i] != -1; i++) par[w][i + 1] = par[par[w][i]][i];
for (long long i = 0; i < edge[w].size(); i++) if (bef != edge[w][i].x){
dfs(edge[w][i].x, w, depth+1, dist + edge[w][i].y);
}
EN[w] = cnt - 1;
}
void Init(int N, int A[], int B[], int D[]) {
long long i, j;
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... |