Help me solve this real problem from my workplace.

Revision en1, by 000golabi, 2019-11-29 03:31:48

“N” people are standing in a line, we name them as a0, a1, ... aN.

The age of any subset of people is defined to be the sum of its individuals.

we want to kill the oldest subset of these N people in a way that for each pair of killed people “ai” and “aj”, the distance is between “p” and “q”.

0< p <= abs(I — j) <= q

p and q are positive numbers. N < 20,000

———-

The above is a problem I came to when designing time series in a charting library. I have converted the original problem into a more readable codeforces style. This will be calculated in each WebGL animation frame, It needs to be fast.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English 000golabi 2019-11-29 03:31:48 689 Initial revision (published)