Under construction

Still being built. Things may change

Bukazoids

Interview

Time limit1sMemory limit128 MB

Summary
Given cell counts and a fixed number of single and double jumps, maximize collected bukazoids and output the lexicographically smallest optimal visit sequence.
Level

Medium4 of 10

Topics
Dynamic programming, Greedy, Array, Implementation
Solved
No attempts yet

Problem

A gluttonous robot lives on a strip of n+1n+1 cells numbered from 00 to nn. The robot starts at cell 00. Every cell other than cell 00 contains some bukazoids, which the robot eats whenever it lands on that cell.

The robot moves only forward and makes exactly two kinds of jumps:

  • a single jump moves it to the next cell (distance 11);
  • a double jump moves it over one cell (distance 22).

It performs exactly mm single jumps and kk double jumps, and these counts satisfy m+2k=nm + 2k = n, so after all of its jumps the robot lands exactly on cell nn. Along the way it collects the bukazoids of every cell it lands on.

Find the maximum total number of bukazoids the robot can collect.

Input

The first line contains three integers nn (1≤n≤1001 \le n \le 100), mm (0≤m≤1000 \le m \le 100), and kk (0≤k≤1000 \le k \le 100), satisfying m+2k=nm + 2k = n.

The second line contains nn integers: the number of bukazoids in cells 1,2,…,n1, 2, \dots, n in order. Each value is an integer between 00 and 100100.

Output

On the first line, print the maximum total number of bukazoids.

On the second line, print the m+k+1m + k + 1 cell numbers the robot visits, starting from cell 00, that achieve this maximum. If several routes collect the maximum, print the lexicographically smallest such sequence of cell numbers (compare the two sequences position by position; the one with the smaller value at the first position where they differ is smaller).

Examples2

  1. Example 1

    Input
    5 1 2
    5 2 7 3 1
    
    Expected output
    13
    0 1 3 5
    
  2. Example 2

    Input
    3 1 1
    5 5 4
    
    Expected output
    9
    0 1 3