当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6924:Swimmer

题目描述
One day, $n$ of swimmers hold a wonderful competition in a swimming pool.

There are $n$ lanes in the swimming pool numbered from $1$ to $n$ , and the their lengths are all $m$ meters. Swimmers are also numbered from $1$ to $n$, and swimmer $i$ occpies lane $i$. The swimmers will start at position $0$, and turn back immediately when arriving at the turn line at position $m$.

They will keep swimming. The speed of swimmers may be different. The speed of the swimmer $i$ is $x_i$ meters per second.

You need to answer $q$ questions: each question gives two integers $p$ and $k$, asking for the position of swimmer $k$ after $p$ seconds.
输入解释
The first line contains three integers $n , m, q$ $(1 \le n \le 10^{6}, 1 \le m \le 10^{9}, 1 \le q \le 10^{6})$, indicating the number of lanes, the length of lanes and the number of questions, respectively.

The second line contains $n$ integers $x_1, x_2, \ldots, x_n$ $(1 \le x_{i} \le 10^{9})$, indicating the speed of each swimmer.

Each of the following $q$ lines contains two integers $p_i, k_i$ $(0 \le p_i \le 10^{9}, 1 \le k_i \le n)$ representing the $i$-th question.
输出解释
Output $q$ lines. Each line contains a single integer, which is the answer of the $i$-th question.
输入样例
1 3 2
1
5 1
7 1
输出样例
1
1
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6924

最后修改于 2021-06-22T18:18:55+00:00 由爬虫自动更新

共提交 2

通过率 0.0%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)