eolymp
bolt
Try our new interface for solving problems
Problems

Polygon

Polygon

\includegraphics{https://static.e-olymp.com/content/7f/7f2d14ad1defe8e158e16fa7a7accf189296025e.jpg} Write a program to find a convex polygon whose sides have the given lengths. In this task, we consider a polygon to be convex if all its inner angles are strictly greater than \textbf{0} degrees and strictly less than \textbf{180} degrees. \InputFile The first line of the file contains an integer N, the number of vertices of the polygon (\textbf{3} ≤ \textbf{N} ≤ \textbf{1000}). Each of the following \textbf{N} lines contains an integer \textbf{a_i}, the length of one side of the polygon (\textbf{1} ≤ \textbf{a_i} ≤ \textbf{10000}). \OutputFile If the desired polygon can be constructed, the output file should contain exactly \textbf{N} lines. Each line should contain two real numbers \textbf{x_i} and \textbf{y_i} (|\textbf{x_i}| ≤ \textbf{10000000}, |\textbf{y_i}| ≤ \textbf{10000000}) such that by connecting the points (\textbf{x_i}, \textbf{y_i}) and (\textbf{x_\{i+1\}}, \textbf{y_\{i+1\}}) for all \textbf{1} ≤ \textbf{i} < \textbf{N} and additionally the points (\textbf{x_N}, \textbf{y_N}) and (\textbf{x_1}, \textbf{y_1}) with line segments, we obtain a convex polygon. The lengths of the line segments must be equal to the numbers given in the input file, but not necessarily in the same order. The vertices of the constructed polygon can be listed either clockwise or counterclockwise. If the polygon cannot be constructed, print \textbf{NO SOLUTION} on the single line of the output file.
Time limit 1 second
Memory limit 16 MiB
Input example #1
4
7
4
5
4
Output example #1
0.5 2.5
7.5 2.5
4.5 6.5
0.5 6.5
Source BOI-2005