Please read the new rule regarding the restriction on the use of AI tools. ×

jyangli's blog

By jyangli, history, 6 hours ago, In English

You have directed acyclic forest. Every node except root nodes have 1 parent.

Query 1: Change parent of one node or make it a root node(it is guaranteed graph will not have cycle)

Query 2: input a node and output the root of the tree that node is in.

Number of nodes = 2e5 Number of queries = 2e5

Full text and comments »

  • Vote: I like it
  • -7
  • Vote: I do not like it