Submission #466635

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4666352021-08-19 19:46:46rainboyRainforest Jumps (APIO21_jumps)C++17
100 / 100
1336 ms22184 KiB
#include "jumps.h"
#include <vector>
using namespace std;
const int N = 200000;
typedef vector<int> vi;
int max(int a, int b) { return a > b ? a : b; }
int aa[N], qu[N];
int ddp[N], pp[N], pp_[N];
int ddq[N], qq[N], qq_[N];
int ddl[N], ll[N], ll_[N];
int ddr[N], rr[N], rr_[N];
int n;
void dfs(int *dd, int *pp, int *pp_, int i) {
if (dd[i])
return;
if (pp[i] == -1)
dd[i] = 1, pp_[i] = -1;
else {
int p, p_;
dfs(dd, pp, pp_, pp[i]);
p = pp[i], p_ = pp_[p];
dd[i] = dd[p] + 1, pp_[i] = dd[p] - dd[pp_[p]] != dd[p_] - dd[pp_[p_]] ? p : pp_[p_];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...