#K92242. Bus Journey Analysis

    ID: 38154 Type: Default 1000ms 256MiB

Bus Journey Analysis

Bus Journey Analysis

In this problem, you are given a series of position reports from various buses. Each report consists of a bus ID and its corresponding x and y coordinates. The task is to compute the total Euclidean distance each bus has traveled and determine which bus has covered the longest distance. In case of a tie, the bus with the smallest ID should be chosen.

The Euclidean distance between two points ((x_1, y_1)) and ((x_2, y_2)) is computed using the formula: [ \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2} ] Ensure that you process the reports in the given order to calculate the consecutive distances correctly.

inputFormat

The first line of input contains a single integer (N), representing the total number of position reports. Each of the following (N) lines contains three integers: (bus_id), (x), and (y), indicating the bus identifier and its coordinates, respectively.

outputFormat

Output a single integer which is the ID of the bus that has traveled the longest total distance. In the event of a tie, output the smallest bus ID among those tied.## sample

8
1 0 0
2 1 1
1 3 4
2 4 5
3 0 0
3 0 5
3 5 5
2 5 7
3

</p>