#include <cmath>using namespace std;const int MAXN = 100000, MAXT = MAXN << 1; const int MAXL = 18, MAXB = 9, MAXC = MAXT / MAXB;struct node { int val; int dep, dfn, end; node *son[2]; // son[0], son[1] 分别表示左右儿子 } T[MAXN];int...