Guarded Vault Heist
MediumA row of n vaults stands in a line. Vault i holds value[i], which may be negative (a trapped vault costs you). Cracking vault i trips an alarm radius, so any two vaults you crack must be at least d indices apart (their indices differ by at least d). You may also crack zero vaults, scoring 0.
Print the maximum total value you can collect.
Input format:
- First line: n d
- Second line: n integers
Print a single integer.
Constraints
1 <= n <= 10^5 1 <= d <= n -10^9 <= value[i] <= 10^9