Wednesday, July 25, 2012

gcj round 3

A. Linearity of expectation and greedy.

B. scared by the picture.

C. I only have some idea before reading solution:
First you can binary search from 1 to M.
Second thing is to find how many delivers you need (this is ternary search but I do not know how)
Third thing is that each delivery is identical, you just find cheapest item that can last i days for i=1 to K, say a delivery can last K days. This can be done in O(N log N) using binary search.

D.

No comments:

Post a Comment