![]() |
Weekly Problems #02 |
Pedro Ribeiro - DCC/FCUP |
This is one of 10 weekly problem sets. Each one is worth 12% of the grade of the "Submitted Implementation" evaluation criteria.
6 proposed problems:
Simply use a custom sort 😉
If the correct answer is s, then the factory cannot make the products in s-1 seconds or in any number of seconds smaller than s. Similarly, it can certainly produce them in s+1 seconds or in any number of seconds bigger than s.
This is a no no ... no yes yes ... yes search space and you can binary search the answer!
Checking if a certain number of seconds is feasible is easy right (you can do it in a greedy fashion with linear time in n)? 😉
Again an optimization problem (find the largest volume). If a certain volume is possible, than certainly all smaller volumes are also possible, right (even if it leads to more spoiled pie)?
How can we use this to binary search on the volume? And when should we stop our search?
Think about the correct answer k. What happens to the cost when k is lower? And when k is bigger? You can even make a program to check these costs. What is the shape of the cost function cost(k)? How can you use this?
Welcome to an interactive problem 😁 Searching all positions is too much, right? Can you think on how some kind of binary search can be applied?
What about making a problem withouth hints? 😃
About the delivery:
Pedro Ribeiro - DCC/FCUP | Last update: