AMBDAY - Editorial

Problem link:

Contest

PREREQUISITES:

Adhoc

PROBLEM:

In this problem we are given a birthday cake with its height being H and width being W. Left end of the cake is placed at x=0 and the right end is placed at x=W.Also we are given F cuts we need to make in this cake.The ith cut should be made at Pi.We need to find the the area of the smallest piece.

EXPLANATION:

This is the easiest problem of the set. It is a very straightforward problem.Include x=0 and x=W in the list of cuts P.Then we need to sort this list of cuts.The area of the smallest piece will be min(P i -P i-1) * H where i ≥ 1. Note that in calculating this minimum value, P should be the sorted list.This was the only tricky thing in this problem.

Solution

I would like to thank you for the time you invest in making such nice post cause as I think it can be very helpful for many people who just wish to get as much information about this topic as possible.