#K6736. Maximum Energy Boost
Maximum Energy Boost
Maximum Energy Boost
Lina has discovered a path filled with checkpoints each offering certain energy boosts. However, there is a catch: if she collects the boost at one checkpoint, she cannot collect the boost at its immediate neighbor. This problem is analogous to the famous "House Robber" problem.
Given an array of non-negative integers where each element represents the energy boost available at a checkpoint, determine the maximum total energy boost Lina can collect without picking two adjacent checkpoints.
The recurrence relation for this problem can be expressed in LaTeX as:
\( dp_{i} = \max(dp_{i-1}, dp_{i-2} + boost[i]) \), for \( i \geq 2 \) with initial conditions \( dp_{0} = boost[0] \) and \( dp_{1} = \max(boost[0], boost[1]) \).
inputFormat
The input is read from standard input. The first line contains an integer \( T \) indicating the number of test cases. For each test case, the first line contains an integer \( N \) denoting the number of checkpoints. The next line contains \( N \) space-separated non-negative integers representing the energy boosts at each checkpoint. If \( N = 0 \), then no numbers will be provided for that test case.
outputFormat
For each test case, output the maximum total energy boost that Lina can obtain, each on a new line, written to standard output.
## sample1
4
3 2 5 10
13
</p>