题目描述
Problem Description
Takahashi is a sushi chef. In front of him, there are $ N $ pieces of sushi rice numbered from $ 0 $ to $ N-1 $ and $ M $ pieces of neta (toppings) numbered from $ 0 $ to $ M-1 $. The weight of rice $ i $ is $ A_i $. Also, the weight of neta $ i $ is $ B_i $.
Takahashi wants to make two pieces of sushi. One piece of sushi is made by combining exactly one piece of rice and one piece of neta.
Takahashi wants the weights of the two pieces of sushi to be equal. Determine if this is possible and, if possible, show one way to make them. Note that the same piece of rice or neta cannot be used twice.
Input Format
The input is given from the standard input in the following format:
$ N $ $ M $ $ A_0 $ $ A_1 $ $\cdots$ $ A_{N-1} $ $ B_0 $ $ B_1 $ $\cdots$ $ B_{M-1} $
Output Format
If it is possible to make two pieces of sushi with equal weight, output four integers $ x, y, z, w $ ($0 \leq x, z \leq N-1, 0 \leq y, w \leq M-1, x \neq z, y \neq w$) separated by spaces. This means that the piece of sushi made by combining rice $ x $ and neta $ y $ and the piece of sushi made by combining rice $ z $ and neta $ w $ are made. If there are multiple solutions, any one of them will be considered correct.
If it is not possible to make two pieces of sushi with equal weight, output $ -1 $.
Sample Input and Output
Sample Input #1
3 4
1 2 4
3 6 10 15
Sample Output #1
0 1 2 0
Sample Input #2
3 3
3 2 1
30 20 10
Sample Output #2
-1
Notes/Hints
Constraints
- $2 \leq N \leq 2 \times 10^5$
- $2 \leq M \leq 2 \times 10^5$
- $1 \leq A_i \leq 10^6$
- $A_i \neq A_j$ ($i \neq j$)
- $1 \leq B_i \leq 10^6$
- $B_i \neq B_j$ ($i \neq j$)
- All values inputted are integers.
Sample Explanation 1
The weight of the piece of sushi made by combining rice $ 0 $ and neta $ 1 $ is $ 1+6=7 $. Also, the weight of the piece of sushi made by combining rice $ 2 $ and neta $ 0 $ is $ 4+3=7 $. Therefore, the output 0 1 2 0 is considered correct.
Sample Explanation 2
It is not possible to make two pieces of sushi with equal weight.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分