#P10579. [蓝桥杯 2024 国 A] 最长子段
[蓝桥杯 2024 国 A] 最长子段
Problem Description
Given a sequence of length and three numbers , you need to find a pair that satisfies:
$$\sum\limits_{i=L}^R s_i > a(bR - cL), \quad 1 \le L \le R \le n$$That is, the sum of terms from the -th to the -th in the sequence is greater than . Among all that satisfy the condition, find the maximum value of .
The testdata guarantees that such a pair and exists.
Input Format
The first line contains four integers , separated by single spaces.
The second line contains integers , separated by single spaces.
Output Format
Output one line containing one integer, which is the answer.
4 1 5 6
1 2 3 4
3
Hint
For of the test cases, .
For all test cases, , , and .
Translated by ChatGPT 5