CommonLounge Archive

[INOI1601] Wealth Disparity (INOI 2016: India)

September 28, 2016

Problem in short: You are given a tree with N nodes, where each node i has a value v[i] associated with it. Find nodes i and j, such that i is an ancestor of j and (v[i] - v[j]) is maximized. N <= 10^5.

Indian National Olympiad in Informatics (INOI) is round 2 out of 3 (i.e. intermediate) for selection into Indian IOI team.

© 2016-2022. All rights reserved.