Impostor_Syndrome's blog

By Impostor_Syndrome, history, 2 years ago, In English

Each edge — 'i' in the graph has two values associated with it — v1[i] and v2[i].
Let M be one of the possible Spanning Tree of the graph. Then define A = max(v1[i]'s for all the edges in ST) and B = max(v2[i]'s for all the edges in the ST).

Then for all the possible Spanning Trees of this graph find the minimum value of A + B.

| Write comment?
»
2 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is there a link where I can submit this problem?

»
2 years ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

iirc link cut tree should work. Check the comments of the editorial of 1386C - Joker for reference.

  • »
    »
    2 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    If the expected time complexity is O(VElog(V)+Elog(E))? Then is there any easier method possible?

    • »
      »
      »
      2 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Use two pointers to find, for each $$$A$$$, the minimum possible $$$B$$$. Now the problem becomes:

      • Support these queries: "add an edge" (to increase $$$A$$$), "remove an edge" (to decrease $$$B$$$), "check if the graph is connected".

      I don't find any "easy" way to answer queries of the third type in $$$O(V \log V)$$$ (a normal DFS works in $$$O(V+E)$$$). Link cut tree is much faster, but it looks overkill.