eolymp
bolt
Try our new interface for solving problems
Problems

Death Star 2

Death Star 2

A long time ago in a galaxy far, far away… The battle space station "Death star" was designed even before the Clone wars. Many years later, it was given to the Empire to control the Outer Rim Territories. The “Death star” was about \textbf{100} miles in diameter, was equipped with a graviton gun, capable of destroying whole planets, and could carry a few thousands of space fighters on board. The "Death star" was supposed to terrify the population and to absolutely exclude any possibility of resisting the power of the Empire. After the first "Death star" had been destroyed by the rebels, the construction of a new, even more deadly model started. The new model, as the first one, has a ball shape and can translationally move in \textbf{N}‑dimensional space. It is equipped with \textbf{M} firmly anchored krypton engines. If the i‑th engine is provided with \textbf{X} units of energy, its contribution to the \textbf{j}‑th coordinate of the jet thrust vector will be equal to \textbf{A_ij · X}. Note that the engines are bidirectional, so supplying a negative \textbf{X} just means using it to thrust in the opposite direction with \textbf{|X|} units of energy. The resulting jet thrust vector is equal to the sum of contributions of each of M engines. Before the beginning of the movement a special navigational module calculates the required coordinates of the jet thrust vector (\textbf{b_1}, \textbf{b_2}, …, \textbf{b_N}).Your program should calculate how much units of energy should be provided to each of the engines in such a way, that the length of the vector of difference between the resulting jet thrust and the required jet thrust will be minimal. If the answer is ambiguous, the sum of squares of the quantity of energy, provided to the engines, should also be minimized. \InputFile The first line contains two integers \textbf{N} and \textbf{M} separated with a space (\textbf{1} ≤ \textbf{N}, \textbf{M} ≤ \textbf{100}). The following \textbf{M} lines with \textbf{N} numbers in each line represent the matrix \textbf{A_ij}. The last line contains \textbf{N} numbers \textbf{b_j} --- the coordinates of required jet thrust vector. All \textbf{A_ij} and \textbf{b_j} are integers with absolute values not exceeding \textbf{100}. \OutputFile Output \textbf{M} real numbers \textbf{X_1}, …, \textbf{X_M} precise up to \textbf{5} digits after the decimal point. \textbf{X_i} should be equal to the quantity of energy, provided to \textbf{i}‑th engine. If there is more than one answer, you can output any one.
Time limit 0.5 seconds
Memory limit 64 MiB
Input example #1
4 3
2 3 -2 1
-1 2 1 3
4 2 3 -2
3 13 -9 13
Output example #1
4.00000 2.00000 -1.00000 
Author Alex Samsonov
Source Ural SU Contest. Petrozavodsk Winter Session, January 2008