Y
Y
yuki2020-09-17 18:15:21
Algorithms
yuki, 2020-09-17 18:15:21

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.


That is, at the entrance
8 - how many boards should be in the fence, 4 - how many there are
x1, x2, x3, x4 - the boards themselves (or rather their heights)

The tasks seem interesting, so I want to tighten up the theory

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wataru, 2020-09-17
@wataru

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 question

Ask a Question

731 491 924 answers to any question