CDIT05 - Editorial

PROBLEM LINK:

Practice

Contest

Author: Akshay Kuchhal

Tester: Akshat Jain

Editorialist: Akshat Jain

DIFFICULTY:

EASY

PREREQUISITES:

Interest in Coding, sorting, loops.

PROBLEM:

We have to calculate minimum number of cakes with strictly decreasing layer sizes.

QUICK EXPLANATION:

The problem may be solved by simply counting the largest number layers with a particular radius.

EXPLANATION:

• First line consist of number of test cases, each test case has number of layers and radii of each layer.

• Input in array form and sort that array.

• Now, just count the adjacent repetitions and update the value of max if count comes out to be greater than max(previously largest).

• Display max as the minimum number of cakes to be formulated so as to use all layers and arrange them in strictly decreasing order towards the top.

AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

Tester’s solution can be found here.