AtCoder Daily Training HARD 2024/03/07 20:30start has begun.
AtCoder Daily Training HARD 2024/03/07 20:30start has ended.
This is a very simple problem. We build a tree according to the question.
Specifically, we connect \(a_i\) to \(i\) and \(i+1\).
And then we dfs the whole tree to find the depth of each node.
posted: last update: