How to solve this magic problem?

Revision en1, by Temirulan, 2018-05-21 00:07:41

Given two weighted trees. f(x, y) — distance between x and y in the first tree, g(x, y) — distance between x and y in the second tree. How many pairs (x, y) such that x < y and f(x, y) < g(x, y). Number of vertices <= 2*10^5.

Tags tree, hard, problem

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
ru3 Russian Temirulan 2018-05-21 14:09:32 7 Мелкая правка: 'x$ и $y$ в первом дереве.' -> 'x$ и $y$ во втором дереве.'
ru2 Russian Temirulan 2018-05-21 12:34:06 23 Мелкая правка: 'le 2*10^5$.' -> 'le 2*10^5$, веса ребер $\le 10^9$.'
ru1 Russian Temirulan 2018-05-21 00:10:54 352 Первая редакция перевода на Русский
en1 English Temirulan 2018-05-21 00:07:41 277 Initial revision (published)