# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1169761 | fryingduc | Fish 3 (JOI24_fish3) | C++20 | 492 ms | 125460 KiB |
#include "bits/stdc++.h"
using namespace std;
#ifdef duc_debug
#include "bits/debug.h"
#else
#define debug(...)
#endif
const int maxn = 3e5 + 5;
const int LG = 19;
int n, q;
long long d, c[maxn];
long long prf[maxn], df[maxn];
long long ps[maxn];
long long st[maxn][LG + 1];
vector<int> g[maxn];
int pr[maxn], up[maxn][LG + 1];
long long dep[maxn];
void pre_dfs(int u) {
for (auto v : g[u]) {
up[v][0] = u;
for (int i = 1; i <= LG; ++i) {
up[v][i] = up[up[v][i - 1]][i - 1];
}
dep[v] = dep[u] + 1ll * (v - u) * (c[v] - prf[v]);
pre_dfs(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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |