diff --git a/content/graph/BinaryLifting.h b/content/graph/BinaryLifting.h index b10b6c327..947d794e8 100644 --- a/content/graph/BinaryLifting.h +++ b/content/graph/BinaryLifting.h @@ -12,8 +12,7 @@ #pragma once vector treeJump(vi& P){ - int on = 1, d = 1; - while(on < sz(P)) on *= 2, d++; + int d = sz(P) < 2 ? 0 : 1 + __lg(sz(P) - 1); vector jmp(d, P); rep(i,1,d) rep(j,0,sz(P)) jmp[i][j] = jmp[i-1][jmp[i-1][j]];