Блог пользователя vishal_sahu

Автор vishal_sahu, история, 17 месяцев назад, По-английски

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;

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится