# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
639806 | milisav | Valley (BOI19_valley) | C++14 | 300 ms | 88688 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int M = 3e5+5;
int d[M], up[M][40], dp[M], mn[M][40], pr[M], ok[M], dist[M];
vector<array<int, 3>> node[M];
pair<int, int> v[M];
void dfs(int s, int p, int dd = 0, int D = 0) {
d[s] = D;
dist[s] = dd;
up[s][0] = p;
dp[s] = (!ok[s])*LLONG_MAX;
for (auto [i, w, x]:node[s]) {
if (i != p) {
if (v[x].first != s) swap(v[x].first, v[x].second);
dfs(i, s, dd+w, D+1);
dp[s] = min(dp[s], dp[i]+w*(dp[i]!=LLONG_MAX));
}
}
pr[s] = dp[s]-dd*(dp[s]!=LLONG_MAX);
}
int lca(int a, int b) {
if (d[a] < d[b]) swap(a, b);
for (int i = 0; i <= 20; i++) if ((d[a]-d[b])&(1<<i)) a = up[a][i];
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |