#P2642. 最大双子段和
最大双子段和
Description
Given an integer sequence of length , select two subarrays (contiguous, non-empty segments of the sequence) such that the total sum of the integers in these two subarrays is maximized, and output that total sum. Each subarray must have a minimum length of , and the two subarrays must be separated by at least one element.
Input Format
The first line contains an integer representing . The second line contains integers representing the sequence.
Output Format
Output a single integer, the maximum total sum of the integers in the two selected subarrays.
5
83 223 -13 1331 -935
1637
3
83 223 -13
70
Hint
Constraints:
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
- All values during the computation are guaranteed to fit within the range of a signed -bit integer.
Translated by ChatGPT 5
京公网安备 11011102002149号