The Magical Stone Solution Codechef

The Magical Stone Solution Codechef Initially, there is a magical stone of mass 2N lying at the origin of the number line. For the next N seconds, the following event happens: Let us define the decomposition of a magical stone as follows: If there is a magical stone of mass M>1 lying at coordinate X, … Read more

Alternating Diameter ALTDIA Solution Codechef

Alternating Diameter ALTDIA Solution Codechef Chef stumbled upon B black nodes and W white nodes and now wants to construct a tree using them. Chef is bamboozled by the total number of trees that can be constructed using these nodes. To reduce this count, Chef considered only those trees which have at least one diameter that … Read more

The Attack of Queen Solution Codechef

The Attack of Queen Solution Codechef Chef has started developing interest in playing chess, and was learning how the Queen moves. Chef has an empty N×N chessboard. He places a Queen at (X,Y) and wonders – What are the number of cells that are under attack by the Queen? Notes: The top-left cell is (1,1), … Read more

Sugarcane Juice Business Solution Codechef

Sugarcane Juice Business Solution

Sugarcane Juice Business Solution Codechef While Alice was drinking sugarcane juice, she started wondering about the following facts: The juicer sells each glass of sugarcane juice for 50 coins.He spends 20% of his total income on buying sugarcane.He spends 20% of his total income on buying salt and mint leaves.He spends 30% of his total … Read more

In The Green Zone ITGRZN Solution Codechef

In The Green Zone ITGRZN Solution Codechef There are N cans lying on the X-axis at points Xi (1≤i≤N). Each of the N cans is associated with two values Ai and Bi. Also, the segment between the points L and R (L≤R) is considered to be green zone including the points L and R. There are … Read more