Answer the question
In order to leave comments, you need to log in
Problems with minimum and maximum variants and non-uniform samples?
Please give links to the material on how to solve such patterns (theory):
There are n boards, you need to build a fence of m boards, while the fence should be as high as possible (the boards can be sawn as a whole (that is, int)), each i board has Xi height.
Answer the question
In order to leave comments, you need to log in
Such problems are often solved by dichotomy + greedy agoritm, as in this example (you need to sort through the answer by binary search, and then see if you can get the required number of boards of a given length from the original ones).
I can't think of any general theory. Still, with discrete optimization, there are a lot of different problems. I can only advise you to look at greedy algorithms. In addition to solutions, be sure to learn how to prove solutions and why greed works in each case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question