C - Ameba 解説 by llichenyu


This is a very simple problem. We build a tree according to the question.

Specifically, we connect aia_i to ii and i+1i+1.

And then we dfs the whole tree to find the depth of each node.

投稿日時:
最終更新:



2025-01-21 (火)
14:30:04 +00:00