Submission #671350

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6713502022-12-12 22:04:04YENGOYANRainforest Jumps (APIO21_jumps)C++17
60 / 100
4035 ms58024 KiB
#include "jumps.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> l, r, h;
vector<vector<int>> upmec, uppoqr;
vector<bool> used;
bool f = 1;
int n;
void calcDp(int u, vector<int> &dp, int c, int d){
if(dp[u] != -1) return;
if(u >= c && u <= d) {
dp[u] = 0;
return;
}
if(l[u] != -1 && r[u] != -1) {
calcDp(l[u], dp, c, d);
calcDp(r[u], dp, c, d);
dp[u] = min(dp[l[u]], dp[r[u]]) + 1;
}
else if(l[u] != -1) {
calcDp(l[u], dp, c, d);
dp[u] = dp[l[u]] + 1;
}
else if(r[u] != -1){
calcDp(r[u], dp, c, d);
dp[u] = dp[r[u]] + 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...