Submission #163346

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1633462019-11-12 18:12:59SaboonValley (BOI19_valley)C++14
100 / 100
645 ms38776 KiB
#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]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...