A higher resolution is required to access the IDE
- 10
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
The Roman Empire is being attacked by UFOs! It is up to the unassuming city guardsman Octavius, son of Septimus, to defend his city with his trusty bow!Octavius begins on top of a watchtower at coordinates
Octavius must shoot down the N UFOs currently menacing the city. Luckily, they are busy abducting hapless civilians and are thus motionless in the sky. The Bow of Sagittarius is extremely powerful, able to take down a UFO in a single shot. To save as many people as possible, Octavius must find the optimal sequence of actions to take in order to strike down all UFOs in the least amount of time. Report the elapsed time to two decimal places, ending when the final UFO is struck.
For this puzzle, the acceleration due to gravity is
Input
Line 1: An integer N, representing the number of UFOs to shoot
Next N lines: Space separated integers x, y, and z, representing the coordinates of a UFO
Next N lines: Space separated integers x, y, and z, representing the coordinates of a UFO
Output
The shortest possible time in seconds required to strike down all UFOs, reported to two decimal places
Constraints
1 ≤ N ≤ 30
-500 ≤ x,z coordinates ≤ 500
1 ≤ y coordinates ≤ 500
All UFOs are possible to hit
-500 ≤ x,z coordinates ≤ 500
1 ≤ y coordinates ≤ 500
All UFOs are possible to hit
Example
Input
2 200 60 0 30 120 0
Output
6.89
A higher resolution is required to access the IDE