Slatan's blog

By Slatan, 9 years ago, In English

Hi, I would appreciate any kind of help on this problem.
You are given n trees, each of which has a position in a map xi, yi (0 ≤ xi, yi ≤ 1000), and a height hi (0 < hi < 10000).
Your task is to calculate the minimum number of trees that should be taken down (and print their indexes), in order to enclose all of the remaining ones with one fence (horizontal and/or vertical, like a rectilinear polygon), such that the total length of this fence is less than or equal to the sum of heights of the trees that you have taken down. The fence should be at least at distance 1 from every enclosed tree.
No more than 30 trees can be taken down, otherwise, we should suppose that there's no possible answer.
Thank you very much,
Slatan.

  • Vote: I like it
  • 0
  • Vote: I do not like it