Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIUCOINS2 - Maximum Sum of Non-Adjacent Coins

You are given N coins arranged in a row. Each coin has a positive value. Select a subset of coins to maximize the total value, with the constraint that no two selected coins can be adjacent.

Input

  • First line: integer N (1 ≤ N ≤ 106)
  • Second line: N positive integers vi (1 ≤ vi ≤ 106)

Output

  • First line: Maximum total value
  • Second line: Indices of selected coins in any order (1-indexed)

Example

Input:

4
5 1 3 2

Output:

8
1 3

Added by:Ha Minh Ngoc
Date:2025-08-30
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.