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
Crossword Puzzle
Cerinta completa A Crossword grid is provided to you, along with a set of words (or names of places) which need to be filled into the grid. Cells are marked either + or -. Cells marked with a – are
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
Crab Graphs
Cerinta completa A crab is an undirected graph which has two kinds of vertices: 1 head, and K feet , and exactly K edges which join the head to each of the feet.( 1 <= K <= T, where T is
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
Counting the Ways
Cerinta completa Little Walter likes playing with his toy scales. He has types of weights. The weight type has weight . There are infinitely many weights of each type. Recently, Walter defined a function, , denoting the number of different
Counting Special Sub-Cubes
Cerinta completa Given an cube, let (where ) denote the value stored in cell . A sub-cube (where ) of an cube is considered to be special if the maximum value stored in any cell in the sub-cube is equal
Counting Valleys
Cerinta completa An avid hiker keeps meticulous records of their hikes. During the last hike that took exactly steps, for every step it was noted if it was an uphill, , or a downhill, step. Hikes always start and end
