Mediumhasharrays
Two Sum Indices
Time limit 2 s · Memory 64 MB
Statement
The first line contains n, the second line contains n integers, the third line contains target. Find the indices (1-based, i < j) of two elements whose sum equals target. Scanning left to right, print the first pair found: the smallest j, and for that j the smallest i. If no such pair exists, print -1.
Constraints
2 ≤ n ≤ 10^5 -10^9 ≤ a_i, target ≤ 10^9
Examples
Input 1
4 2 7 11 15 9
Output 1
1 2
Input 2
5 3 2 4 1 5 6
Output 2
2 3