vishal_sahu's blog

By vishal_sahu, history, 18 months ago, In English

Given a weighted tree consisting of N vertices and N-1 edges. In a single operation, you can select an edge and increase or decrease its weight by 1. You are given Q queries and a query consisting of two vertices U and V, determine the minimum number of operations to be performed such that the weight of each edge of the path from vertex U to vertex V becomes the same.

With constraint up to 10^5;

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it