FIICode 2024 Elevi | Gank Botlane

This was the problem page during the contest. Access the current page here.
Time limit: 1s
Memory limit: 256MB
Input:
Output:

NUME\mathbb{NUME} wants to gank botlane, but first, he has to solve this problem and you need to help him:

Given an array aa of nn integers, he wants to find a subarray of aa in which the sum of elements on odd positions is equal to the sum of elements on even positions. The positions are considered to be the ones from the initial array.

More formally, you need to find ll and rr such that:

i=li oddrai=i=li evenrai\displaystyle \sum_{\substack{i = l\\i \text{ odd}}}^r a_i = \sum_{\substack{i = l\\i \text{ even}}}^r a_i

Help him solve this problem fast so that he can get that double kill.

Input

The first line contains a single integer nn (1n1051 \le n \le 10^5) – the length of the array aa.

The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai1091 \le a_i \le 10^9).

Output

Print ll and rr – the indices chosen for the operation.

If there are multiple solutions, print the one that minimizes ll. If there are multiple solutions that minimize ll, print the one that minimizes rr.

If there are no solutions, print 1-1.

Example 1

stdin

7
8 2 3 4 3 1 7

stdout

2 5

Example 2

stdin

4
1 1 1 1

stdout

1 2

Example 3

stdin

5
5 4 3 2 1

stdout

-1

Contest info

Official contest

Start time: 1710082800000

Total duration: 2h30m0s

Status: Ended

Log in or sign up to be able to send submissions!