看题解写的都是 dsu on tree,MnZn看不懂,想问能不能构造 ai=deplcai,i+1a_i=dep_{lca_{i,i+1}}ai=deplcai,i+1 并用单调栈求出每个aia_iai 作为最小值的极长区间。
dsu on tree