gitesh18's blog

By gitesh18, history, 7 years ago, In English

Can anybody help me with this problem Perfect Cakes.This problem was asked in Directi recruitment challenge.

  • Vote: I like it
  • +6
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

This is the same problem as UVA 665 which by the way is a problem from NEERC 1998 (tests there aren't really that strong, though model solution is correct).

Since the sample cake has different mass than the others, imagine first that it has lower mass. Then perform all checks and mark the possibility for the cakes (for instance, if you have a < comparison, you mark the cakes on the left side as possible ones to be the different one in case you know nothing about them, and all the others, including those not in the comparison, as surely not being the sample cake).

Do the same if it had bigger mass and compare the solutions, either they point to the same cake or one gives an invalid solution and the other a unique solution. This is necessary since we only knew the cake had different mass than the others.