CodeLab Academy 📞 9936 6696
← List Python · Level 9: Functions and dicts Code · 90 points ← #830 #832 →

#831. Two sum (positions)

You get a list and k. Print the positions i, j (counting from 1) of a pair with a[i] + a[j] = k (i < j). If there are many pairs, print the one with the smallest i, then the smallest j. If there is none, print -1. Use a dictionary to make it fast. ### Input The first line has n, the second line has n integers separated by spaces. The third line has k. ### Output i j or -1.

Examples

Input
4
14 14 8 0
17
Output
-1
Input
7
0 0 5 2 7 13 10
15
Output
3 7

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!