Deforestation

Cerinta completa Alice and Bob are playing a game with a rooted tree. The tree has vertices and the first node, , is always the root. Here are the basic rules: They move in alternating turns, and both players always

Cut the Tree

Cerinta completa There is an undirected tree where each vertex is numbered from to , and each contains a data value. The sum of a tree is the sum of all its nodes’ data values. If an edge is cut,

Cutting Boards

Cerinta completa Alice gives Bob a board composed of wooden squares and asks him to find the minimum cost of breaking the board back down into its individual squares. To break the board down, Bob must make cuts along its

Cut Tree

Cerinta completa Given a tree T with n nodes, how many subtrees (T’) of T have at most K edges connected to (T – T’)? Input Format The first line contains two integers n and K followed by n-1 lines

DAG Queries

Cerinta completa You are given a Directed Acyclic Graph (DAG) with vertices and edges. Each vertex has an integer, , associated with it and the initial value of is for all vertices. You must perform queries on the DAG, where

Covering the stains

Cerinta completa There is a huge blanket on your bed but unfortunately it has N stains. You cover them using a single, rectangular silk cloth. The silk is expensive, which is why the rectangular piece needs to have the least

Cut the sticks

Cerinta completa You are given a number of sticks of varying lengths. You will iteratively cut the sticks into smaller sticks, discarding the shortest pieces until there are none left. At each iteration you will determine the length of the

Counting Sort 2

Cerinta completa Often, when a list is sorted, the elements being sorted are just keys to other values. For example, if you are sorting files by their size, the sizes need to stay connected to their respective files. You cannot