#C3579. Minimum Absolute Difference Subarray
Minimum Absolute Difference Subarray
Minimum Absolute Difference Subarray
You are given an array of n integers. Your task is to find two indices \(x\) and \(y\) (with \(1 \le x < y \le n\)) such that the absolute difference between the sum of the subarray from index \(x\) to \(y\) and the sum of the remaining elements in the array is minimized.
More formally, let the array be \(a_1, a_2, \dots, a_n\) and the total sum be \(S = \sum_{i=1}^{n} a_i\). You need to choose \(x\) and \(y\) so that the value \[ |\sum_{i=x}^{y} a_i - (S - \sum_{i=x}^{y} a_i)| \] is minimized. If there are multiple answers, you may output any one of them.
Note: The indices are 1-based.
inputFormat
The first line of input contains a single integer \(n\) (\(2 \le n \le 10^5\)), the number of elements in the array.
The second line contains \(n\) space-separated integers representing the array elements \(a_1, a_2, \dots, a_n\).
outputFormat
Output two space-separated integers \(x\) and \(y\) (1-based indices) such that \(1 \le x < y \le n\) and the absolute difference described above is minimized.
## sample5
1 2 3 4 5
3 4
</p>