Heavy Light 2 White Falcon

Cerinta completa White Falcon was amazed by what she can do with heavy-light decomposition on trees. As a resut, she wants to improve her expertise on heavy-light decomposition. Her teacher gave her an another assignment which requires path updates. As

Company Retreat

Cerinta completa The LRT Company has employees. Each employee has a unique ID number from to , where the director’s ID is number . Every employee in the company has exactly one immediate supervisor — except the director, who has

Heavy Light White Falcon

Cerinta completa Our lazy white falcon finally decided to learn heavy-light decomposition. Her teacher gave an assignment for her to practice this new technique. Please help her by solving this problem. You are given a tree with nodes and each

BST maintenance

Cerinta completa Consider a binary search tree T which is initially empty. Also, consider the first N positive integers {1, 2, 3, 4, 5, ….., N} and its permutation P {a1, a2, …, aN}. If we start adding these numbers

Array Pairs

Cerinta completa Consider an array of integers, . Find and print the total number of pairs such that where . Input Format The first line contains an integer, , denoting the number of elements in the array. The second line

Burger Happiness

Cerinta completa In Burger Town new burger restaurants will be opened! Concretely, restaurants will open in days, while restaurant will be opened on day and will be located at . The town should be imagined as an one dimensional line