Yuckdonald's is considering opening a series of restaurants along Quaint Valley Highway (QVH). The $n$ possible locations are along a straight line, and the distances of these locations from the start of $Q$ VH are, in miles and in increasing order, $m_{1}, m_{2}, \ldots, m_{n} .$ The constraints are as follows:
$\bullet$At each location, Yuckdonald's may open at most one restaurant. The expected profit from opening a restaurant at location $i$ is $p_{i},$ where $p_{i}>0$ and $i=1,2, \ldots, n$
$\bullet$ Any two restaurants should be at least $k$ miles apart, where $k$ is a positive integer.
Give an efficient algorithm to compute the maximum expected total profit subject to the given constraints.