find the max (no clue yet)

Suppose there are n objects. Each object has two attributes xi and yi (1<=xi,yi<=10^6).

You can only choose k objects. The score of your choice is caculated by the multiplication of

  1. min of yi in those k objects and
  2. sum of the xi of those k objects.

Which k objects you should choose to maximize the score of your choice? (1<=k<=n<=3*10^5)

Example, there are 3 objects, their attributes are below:

1 1
2 2
3 3

You can choose 2 objects.

Then the maximum score of your choice is (2+3)*2=10.

Comments (3)