Same Color — Help!

Revision en1, by vishal_sahu, 2023-07-01 17:08:41

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;

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English vishal_sahu 2023-07-01 17:08:41 424 Initial revision (published)