eolymp
bolt
Try our new interface for solving problems
Problems

The distance between the segments

The distance between the segments

Given two segments in space (\textbf{x_1}; \textbf{y_1}; \textbf{z_1}) - (\textbf{x_2}; \textbf{y_2}; \textbf{z_2}) and (\textbf{x_3}; \textbf{y_3}; \textbf{z_3}) - (\textbf{x_4}; \textbf{y_4}; \textbf{z_4}). Find the distance between the segments. \InputFile Given integers \textbf{x_1}; \textbf{y_1}; \textbf{z_1}; \textbf{x_2}; \textbf{y_2}; \textbf{z_2}; \textbf{x_3}; \textbf{y_3}; \textbf{z_3}; \textbf{x_4}; \textbf{y_4}; \textbf{z_4}. The coordinates do not exceed \textbf{1000}. \OutputFile Print the distance between the segments with at least \textbf{6} digits after the decimal point.
Time limit 1 second
Memory limit 256 MiB
Input example #1
0 0 0
1 1 1
0 0 1
0 1 0
Output example #1
0.40824829
Author Stanislav Pak
Source Winter School, Kharkov, 2011, Day 1