This page is still under construction.

Parts of this page are still being built. What you see may change.

Honey Butter Chip

Interview

Time limit5sMemory limit256 MB

Summary
Arrange the M extra bags within the N fixed bags and pick no two adjacent bags to maximize the chip total.
Level

Medium5 of 10

Topics
Dynamic programming, Array
Solved
No attempts yet

Problem

Insert M bags among N ordered bags, then pick a non-adjacent subset to maximize chips.

Input

Read N, list A, M, list B.

Output

Print the maximum number of chips.

Examples1

  1. Example 1

    Input
    5
    10
    12
    6
    14
    7
    3
    1
    8
    2
    
    Expected output
    44