# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
163346 | Saboon | Valley (BOI19_valley) | C++14 | 645 ms | 38776 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 10;
const ll inf = 1e18;
vector<pair<int, int> > t[maxn];
int w[maxn];
int dw[maxn], h[maxn];
int Time, st[maxn], ft[maxn];
int par[maxn][18];
ll dis[maxn], dp[maxn], RMQ[maxn][18];
ll get(int v, int x){
ll ret = inf;
for (int i = 17; i >= 0; i--)
if (x & (1 << i)){
ret = min(ret, RMQ[v][i]);
v = par[v][i];
}
return ret;
}
void DFS(int v, int p = -1){
par[v][0] = p;
RMQ[v][0] = dp[v] - 2ll * dis[v];
for (int i = 1; i < 18 and par[v][i - 1] != -1; i++){
par[v][i] = par[par[v][i - 1]][i - 1];
RMQ[v][i] = min(RMQ[v][i - 1], RMQ[par[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... |