#P9787. [ROIR 2020] 最大乘积 (Day2)
[ROIR 2020] 最大乘积 (Day2)
Problem Description
Translated from ROIR 2020 Day2 T1. Максимальное произведение, translator: ShineEternal.
You are given an array of natural numbers .
Define the weight of an array as the sum of all numbers in the array.
Please split this array into two non-empty arrays and , so that the product of their weights is as large as possible.
You need to determine the that maximizes the product of the weights of the two arrays.
Input Format
The first line contains an integer , representing the number of elements.
The second line contains integers , representing the elements in the array.
Output Format
Output an that maximizes the product of the weights of and .
If there are multiple answers, you may output any one of them.
3
1 2 3
2
Hint
Sample 1 Explanation
If you choose , then the product of weights is .
If you choose , then the product of weights is .
Constraints
For of the testdata, .
The detailed limits are shown in the table below:
| Subtask ID | Score | Limit | Additional Limit |
|---|---|---|---|
Translated by ChatGPT 5