Responsive image

问题 1871 --Casual Podracing

1871: Casual Podracing

时间限制: 6 Sec  内存限制: 128 MB
提交: 3  解决: 0
[提交][状态][讨论版][命题人:]

题目描述

> Podracing was a dangerous racing sport on planets such as Malastare, Theron, and Tatooine. Racers could perform multiple laps on a particular race track, moving at dangerous and, at times, deadly speeds. The races were performed using craft known as Podracers or pods, which were small, one-man craft propelled by large engines. Races could then be projected in entertainment establishments throughout the galaxy.
>
> — Wookieepedia
Anakin Skywalker is the only human known to compete in Podracing. To win this dangerous racing, in which the participant may lose his life, little Anakin has to practice with his friends under a much softer rule.
Participants have to compete in a circular track (L in length). At the beginning of the racing (time zero), all podracers are at distinct locations. The i-th podracer starts at location di (0≤di<L), then the Podracing starts. Since all Anakin’s friends built their own podracers, they have distinct speeds. The speed of the i-th participant is vi (the speed can either be positive or negative. A positive speed indicates a clockwise podracer and a negative speed indicates a counterclockwise podracer). 
Furthermore, the i-th participant has a power of wi. During the racing, participants may meet (being located at the same place at the same time). To better record the progress of the racing, Anakin decides to mark the participants whose powers are strictly less than the maximum power of the participants he ever met, indicating that they are a loser. Since they are just practicing, being marked does not mean the participant is out, he can continue competing and mark someone else with less power.
When no one can be marked, the racing terminates. 
Find the terminal time of the racing.
 

输入描述

The first line of the input contains an integer T (T≤20), denoting the number of test cases. 
For each test case, the first line contains two integers n,L (1≤L≤10^6). 
The next line contains n distinct integers, denoting di (0≤di<L).
The next line contains n distinct integers, denoting vi (|vi|≤10^6).
The next line contains n integers, denoting wi (0≤wi≤n).
The sum of n in all test cases won't be greater than 10^5.
 

输出描述

For each test case, you should output the answer as a fraction that is reduced to lowest terms.
If the answer is 0, you should just output "0".

样例输入

1
8 8
2 1 5 7 4 6 0 3
86 27 -85 -8 11 73 -37 -69
0 6 4 4 3 0 2 5

样例输出

4/61

来源

 

[提交][状态]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版