# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
422425 | tengiz05 | 공장들 (JOI14_factories) | C++17 | 4003 ms | 264452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "factories.h"
#include <bits/stdc++.h>
using i64 = long long;
constexpr int N = 500000, K = 20, M = 2 * N + 5;
std::vector<std::pair<int, i64>> e[N];
i64 st[M][K + 1];
int lg[M + 1], n, P[N], timer;
i64 D[N];
i64 pos[M];
std::vector<int> order;
int par[N];
void dfs(int u, int p, i64 d = 0){
order.push_back(u);
par[u] = p;
P[u] = timer;
pos[timer++] = d;
D[u] = d;
for (auto [v, w] : e[u]) {
if (v != p) {
dfs(v, u, d + w);
pos[timer++] = d;
}
}
}
inline i64 range(int L, int R) {
if (L > R) std::swap(L, R);
int j = lg[R - L + 1];
return std::min(st[L][j], st[R - (1 << j) + 1][j]);
}
inline i64 dist(int u, int v) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |