You are given an array of integers \(A\) of size \(N\). Cost of a segment \((L,R)\) is defined as \((A[L] + A[L+1] + .... +A[R])\) - \((A[L] \oplus A[L+1] \oplus .... \oplus A[R])\) (where \(\newcommand*\xor{\oplus}\) denotes the Bitwise XOR operator).
Given a range \((x, y)\), find the smallest subsegment \((x', y')\) such that \(x \le x' \le y' \le y\) and its cost is maximum among all the subsegments of \((x, y)\).
If there exists more than answer, print the subsegment with smallest \(x'\).
Input format
- First line contains an integer \(N\)
- Second line contains \(N\) space-separated integers denoting the array \(A\)
- Next line contains two space separated integer \(x\ y\)
Output format
Print two space separated integers \(x' \ y'\) denoting the subsegment.
Constraints
\(1 \le N \le 10^5 \\ 0 \le A[i] \le 10^9 \\ 1 \le x \le y \le N\)
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial