CROC-MBTU 2012, Final Round (Online version, Div. 2)
D
Building Bridge
Codeforces
1900
原题
← CE →
翻译中…

Two villages are separated by a river that flows from the north to the south. The villagers want to build a bridge across the river to make it easier to move across the villages.

翻译中…

The river banks can be assumed to be vertical straight lines $*x* = *a*$ and $*x* = *b*$ ($0 < *a* < *b*$).

翻译中…

The west village lies in a steppe at point $*O* = (0, 0)$. There are $*n*$ pathways leading from the village to the river, they end at points $*A*_{*i*} = (*a*, *y*_{*i*})$. The villagers there are plain and simple, so their pathways are straight segments as well.

翻译中…

The east village has reserved and cunning people. Their village is in the forest on the east bank of the river, but its exact position is not clear. There are $*m*$ twisted paths leading from this village to the river and ending at points $*B*_{*i*} = (*b*, *y*'_{*i*})$. The lengths of all these paths are known, the length of the path that leads from the eastern village to point $*B*_{*i*}$, equals $*l*_{*i*}$.

翻译中…

The villagers want to choose exactly one point on the left bank of river $*A*_{*i*}$, exactly one point on the right bank $*B*_{*j*}$ and connect them by a straight-line bridge so as to make the total distance between the villages (the sum of $|*OA*_{*i*}| + |*A*_{*i*}*B*_{*j*}| + *l*_{*j*}$, where $|*XY*|$ is the Euclidean distance between points $*X*$ and $*Y*$) were minimum. The Euclidean distance between points $(*x*_{1}, *y*_{1})$ and $(*x*_{2}, *y*_{2})$ equals image.

翻译中…

Help them and find the required pair of points.

翻译中…

Input

翻译中…

The first line contains integers $*n*$, $*m*$, $*a*$, $*b*$ ($1 ≤ *n*, *m* ≤ 10^{5}$, $0 < *a* < *b* < 10^{6}$).

翻译中…

The second line contains $*n*$ integers in the ascending order: the $*i*$-th integer determines the coordinate of point $*A*_{*i*}$ and equals $*y*_{*i*}$ ($|*y*_{*i*}| ≤ 10^{6}$).

翻译中…

The third line contains $*m*$ integers in the ascending order: the $*i*$-th integer determines the coordinate of point $*B*_{*i*}$ and equals $*y*'_{*i*}$ ($|*y*'_{*i*}| ≤ 10^{6}$).

翻译中…

The fourth line contains $*m*$ more integers: the $*i*$-th of them determines the length of the path that connects the eastern village and point $*B*_{*i*}$, and equals $*l*_{*i*}$ ($1 ≤ *l*_{*i*} ≤ 10^{6}$).

翻译中…

It is guaranteed, that there is such a point $*C*$ with abscissa at least $*b*$, that $|*B*_{*i*}*C*| ≤ *l*_{*i*}$ for all $*i*$ $(1 ≤ *i* ≤ *m*)$. It is guaranteed that no two points $*A*_{*i*}$ coincide. It is guaranteed that no two points $*B*_{*i*}$ coincide.

翻译中…

Output

翻译中…

Print two integers — the numbers of points on the left (west) and right (east) banks, respectively, between which you need to build a bridge. You can assume that the points on the west bank are numbered from $1$ to $*n*$, in the order in which they are given in the input. Similarly, the points on the east bank are numbered from $1$ to $*m*$ in the order in which they are given in the input.

翻译中…

If there are multiple solutions, print any of them. The solution will be accepted if the final length of the path will differ from the answer of the jury by no more than $10^{ - 6}$ in absolute or relative value.

翻译中…

样例

Input #1
3 2 3 5
-2 -1 4
-1 2
7 3
Output #1
2 2
InputCopy OutputCopy
题目信息
题号
250D
时间限制
1 s
内存限制
256 MB
标签
计算几何
三分
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。