Cablemaxxing
YOU: "You were stationed very close to the crime scene. Did you hear any noises coming from backstage at the time of the incident?"
LUKAZ: "Nah, I had no idea. Look, I was stressed, okay? I wasn't exactly cataloguing every sound in the building.
There was clattering from the kitchen the whole time. Glasses clinking from the bar. And about twelve frantic computer science students just yammering over each other. You can see why I might not be able to isolate whatever it is you're looking for.
Do you understand how long I spent dialling in the audio? Hours! And now it's all for nothing. I mean, rest in peace, Kevin. But come on!"
Lukaz is a very dedicated AV (Audio-Visual) guy.
To avoid last-minute issues with the display, he wants to use the longest cable he has available. Unfortunately, all the cables are mixed and tangled together, making the best cable to use a bit unclear.
Lukaz's cables are represented by straight segments of wire on a 2D plane. Two wires belong to the same cable if they share a common endpoint, in other words, a cable is a maximal group of wires connected through shared endpoints. The length of a cable is the sum of the lengths of its wires.
What is the length of the longest cable that Lukaz can use?
Input
The first line contains a single integer
, the number of wire segments that Lukaz has.
The next lines each contain two integer points
and
, indicating that there is a straight segment of wire between points
and
.
- All wires are unique.
for each wire.
- Any point may appear at most twice across all wire endpoints.
- Wires connect only at shared endpoints. Two wires that cross or overlap without sharing an endpoint are not connected.
- The wires do not form a cycle. Together with the previous conditions, this guarantees that every cable is a simple, non-branching path.
Output
Output the length of the longest cable. Submit so it is correct to exactly decimal places.
Example
Input 1
10
1 1 3 3
3 3 4 6
4 6 5 4
3 4 1 5
1 5 6 5
2 4 2 1
2 1 6 4
6 4 6 2
6 2 4 2
4 2 5 3
Output 1
13.414213562373
The longest cable is the red one shown below, at units.

Input 2
6
1 1 6 6
4 3 3 3
3 3 3 4
3 4 5 4
5 4 5 2
5 2 3 2
Output 2
8.000000000000
The longest cable is the yellow one shown below, at units.

Input 3
5
1 4 4 1
2 4 5 1
2 5 5 2
3 5 6 2
3 6 6 3
Output 3
4.242640687119
All cables are the same length, at units.

Comments
hi