CF9B.Running Student

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

And again a misfortune fell on Poor Student. He is being late for an exam.

Having rushed to a bus stop that is in point (0, 0), he got on a minibus and they drove along a straight line, parallel to axis OX, in the direction of increasing x.

Poor Student knows the following:

  • during one run the minibus makes n stops, the i-th stop is in point (x__i, 0)
  • coordinates of all the stops are different
  • the minibus drives at a constant speed, equal to v__b
  • it can be assumed the passengers get on and off the minibus at a bus stop momentarily
  • Student can get off the minibus only at a bus stop
  • Student will have to get off the minibus at a terminal stop, if he does not get off earlier
  • the University, where the exam will be held, is in point (x__u, y__u)
  • Student can run from a bus stop to the University at a constant speed v__s as long as needed
  • a distance between two points can be calculated according to the following formula:
  • Student is already on the minibus, so, he cannot get off at the first bus stop

Poor Student wants to get to the University as soon as possible. Help him to choose the bus stop, where he should get off. If such bus stops are multiple, choose the bus stop closest to the University.

可怜的学生再次遭遇不幸——他考试迟到了。

他匆忙赶到位于点 (0,0)(0,\,0) 的公交车站,登上一辆小型巴士,该车沿一条与 OXOX 轴平行的直线行驶,方向为 xx 坐标递增的方向。

可怜的学生知道以下信息:

  • 每次运行过程中,小型巴士共停靠 nn 站,第 ii 站位于点 (xi,0)(x_i,\,0)
  • 所有停靠站的坐标互不相同;
  • 小型巴士以恒定速度 vbv_b 行驶;
  • 可假设乘客在车站上下车所需时间为零(即瞬时完成);
  • 学生只能在公交车站下车;
  • 若学生未提前下车,则必须在终点站下车;
  • 举行考试的大学位于点 (xu,yu)(x_u,\,y_u)
  • 学生可从任意车站以恒定速度 vsv_s 跑向大学,且跑步时间不受限制;
  • 两点间距离按如下公式计算:
  • 学生已乘坐上小型巴士,因此不能在第一个车站下车。

可怜的学生希望尽快抵达大学。请帮他选择应在哪个车站下车。若存在多个满足条件的车站,则选择离大学最近的那个车站。

输入格式

The first line contains three integer numbers: 2 ≤ n ≤ 100, 1 ≤ v__b, v__s ≤ 1000. The second line contains n non-negative integers in ascending order: coordinates x__i of the bus stop with index i. It is guaranteed that _x_1 equals to zero, and x__n ≤ 105. The third line contains the coordinates of the University, integers x__u and y__u, not exceeding 105 in absolute value.

第一行包含三个整数:2n1002 ≤ n ≤ 1001vb,vs10001 ≤ v_b, v_s ≤ 1000
第二行包含 nn 个按升序排列的非负整数:编号为 ii 的公交站的坐标 xix_i。保证 x1=0x_1 = 0,且 xn105x_n ≤ 10^5
第三行包含大学的坐标,即整数 xux_uyuy_u,其绝对值均不超过 10510^5

输出格式

In the only line output the answer to the problem — index of the optimum bus stop.

在唯一的一行中输出问题的答案——最优公交站的编号。

输入输出样例

  • 输入#1

    4 5 2
    0 2 4 6
    4 1

    输出#1

    3
  • 输入#2

    2 1 1
    0 100000
    100000 100000

    输出#2

    2

说明/提示

As you know, students are a special sort of people, and minibuses usually do not hurry. That's why you should not be surprised, if Student's speed is higher than the speed of the minibus.

众所周知,学生是一类特殊的人群,而小型巴士通常并不着急。因此,如果学生的速度高于小型巴士的速度,你也不必感到惊讶。

输入解题思路,AI测评打分。不知道怎么写?

首页