#P5413. [YNOI2019] 骑单车

    ID: 4346 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>模拟2019各省省选Special Judge云南

[YNOI2019] 骑单车

Description

Xiaoming needs to ride a bicycle through nn road segments every morning to get to class. The length of the ii-th segment is wi(m)w_i (m), and the speed limit is si(m/s)s_i (m/s) (the riding speed on the road cannot exceed the speed limit). The maximum absolute value of acceleration is ai(m/s2)a_i (m/s^{2}) (he can either speed up or slow down). The initial speed is 0(m/s)0 (m/s). Your task is to compute the minimum time for Xiaoming to pass these nn segments.

Input Format

This problem contains multiple test cases.

The first line contains a positive integer TT, representing the number of test cases.

Then follow TT test cases, each in the following format:

Each test case contains n+1n+1 lines.

The first line contains a positive integer nn, representing that there are nn road segments.

The next nn lines each contain three positive integers wi,si,aiw_i, s_i, a_i, representing the length, the speed limit, and the maximum absolute acceleration of the ii-th segment, respectively.

Output Format

Output TT lines, corresponding to the answers for the TT test cases. That is, the minimum time Xiaoming needs to pass the nn road segments (your answer is accepted as long as the absolute error from the standard answer is within 10510^{-5}).

1
2
5 3 1
1 1 1

4.6904157598

Hint

For 60%60\% of the testdata: 0<n600 < n \le 60.

For 80%80\% of the testdata: 0<n800 < n \le 80.

For 100%100\% of the testdata: 0<n102,wi,si,ai100 < n \le 10^{2}, w_i, s_i, a_i \le 10.

Translated by ChatGPT 5