# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1164929 | fryingduc | Valley (BOI19_valley) | C++20 | 169 ms | 37236 KiB |
#include "bits/stdc++.h"
using namespace std;
#ifdef duc_debug
#include "bits/debug.h"
#else
#define debug(...)
#endif
const int maxn = 1e5 + 5;
const int LG = 18;
int n, s, q, e;
int eu[maxn], ev[maxn], ew[maxn];
vector<pair<int, int>> g[maxn];
bool spec[maxn];
int up[maxn][LG + 1], h[maxn];
long long st[maxn][LG + 1];
long long dep[maxn];
long long f[maxn];
void pre_dfs(int u, int prev) {
f[u] = 1e18;
if (spec[u]) f[u] = 0;
for (auto [v, w] : g[u]) {
if (v == prev) continue;
up[v][0] = u;
for (int i = 1; i <= LG; ++i) {
up[v][i] = up[up[v][i - 1]][i - 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |