キーエンスプログラミングコンテスト2022(AtCoder Beginner Contest 274)が開始されました。
キーエンスプログラミングコンテスト2022(AtCoder Beginner Contest 274)は終了しました。
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.
投稿日時: 最終更新: