CF250D.Building Bridge

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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=ax=a and x=bx=b ( 0<a<b ).

The west village lies in a steppe at point O=(0,0)O=(0,0) . There are nn pathways leading from the village to the river, they end at points Ai=(a,yi)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 mm twisted paths leading from this village to the river and ending at points Bi=(b,yi)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 BiB_{i} , equals lil_{i} .

The villagers want to choose exactly one point on the left bank of river AiA_{i} , exactly one point on the right bank BjB_{j} and connect them by a straight-line bridge so as to make the total distance between the villages (the sum of OAi+AiBj+lj|OA_{i}|+|A_{i}B_{j}|+l_{j} , where XY|XY| is the Euclidean distance between points XX and YY ) were minimum. The Euclidean distance between points (x1,y1)(x_{1},y_{1}) and (x2,y2)(x_{2},y_{2}) equals .

Help them and find the required pair of points.

输入格式

The first line contains integers nn , mm , aa , bb ( 1<=n,m<=1051<=n,m<=10^{5} , 0<a<b<10^{6} ).

The second line contains nn integers in the ascending order: the ii -th integer determines the coordinate of point AiA_{i} and equals yiy_{i} ( yi<=106|y_{i}|<=10^{6} ).

The third line contains mm integers in the ascending order: the ii -th integer determines the coordinate of point BiB_{i} and equals yiy'_{i} ( yi<=106|y'_{i}|<=10^{6} ).

The fourth line contains mm more integers: the ii -th of them determines the length of the path that connects the eastern village and point BiB_{i} , and equals lil_{i} ( 1<=li<=1061<=l_{i}<=10^{6} ).

It is guaranteed, that there is such a point CC with abscissa at least bb , that BiC<=li|B_{i}C|<=l_{i} for all ii (1<=i<=m)(1<=i<=m) . It is guaranteed that no two points AiA_{i} coincide. It is guaranteed that no two points BiB_{i} coincide.

输出格式

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 11 to nn , in the order in which they are given in the input. Similarly, the points on the east bank are numbered from 11 to mm 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 10610^{-6} in absolute or relative value.

输入输出样例

  • 输入#1

    3 2 3 5
    -2 -1 4
    -1 2
    7 3
    

    输出#1

    2 2
首页