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

建议使用的浏览器:

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

6136:Death Podracing

题目描述
> During the Trade Federation invasion of Naboo, Anakin Skywalker won the Boonta Eve Classic on Tatooine, securing his freedom from a life of slavery. Betting on the races was a popular pastime with many of the watchers on Tatooine and it was through Qui-Gon Jinn's bet with Watto that Skywalker would win the race that Skywalker was freed.
>
> — Wookieepedia

Here comes the most awesome racing in the universe! Little Anakin sits in his own podracer, breathing deeply. He must win.

The real podracing is deadly. In this circular track (again $L$ in length), participants start in distinct locations and race with distinct speeds (the speed can be positive and minus, which means running clockwise and counterclockwise). Every podracer is equipped with a powerful weapon system respectively -- all for triumphing over enemies!!! yes! enemies!

If two competitors meet, which means that they reach an identical location simultaneously, the one with less powerful weapon system will be destroyed and be knocked out of the racing -- dead or alive. The power of the $i$-th participant is exactly $i$, and because each person runs with a distinct speed, so there must be a winner.

The racing stops when there is only one person still running in the track -- our winner! The others are crushed into pieces.

Little Anakin wants to know, when the racing will stop.
输入解释
The first line contains an integer $T$ ($T \le 1000$), denoting the number of test cases.

For each test case, the first line contains two integers $n$ ($2\le n\le 10^5$) and $L$ ($1\le L\le10^9$).

The following line contains $n$ distinct integers $d_1, d_2, ..., d_n$ ($0 \le d_i \lt L$), representing the starting points of the participants.

The next line contains $n$ distinct integers $v_1, v_2, ... , v_n$ ($0 \le |v_i| \le 10^9$), representing the velocity of the participants.

The sum of all $n$ in all test cases doesn't exceed $2 \times 10^6$.
输出解释
One line for each test case. You should output the answer that is reduced to lowest terms.
输入样例
2
2 4
0 2
3 2
10 100
56 89 62 71 7 24 83 1 47 52
9 -16 34 -38 47 49 -32 17 39 -9
输出样例
2/1
37/7
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6136

最后修改于 2020-10-25T23:28:40+00:00 由爬虫自动更新

共提交 0

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