SP8105 DPMAX - Dot Product Maximization
Description
Given two vectors, a = ( x $ _{a} $ , y $ _{a} $ ), b = ( x $ _{b} $ , y $ _{b} $ ), their dot product is defined as follows:
dp( a, b ) = x $ _{a} $ \*x $ _{b} $ + y $ _{a} $ \*y $ _{b} $ .
Given N vectors in the plane, find a pair for each of them (among those given in the input) such that the dot product of the vector and its pair is maximal. You may pair a vector with itself too.
Input Format
The first line of input contains a single integer N ( 1
Output Format
Output N lines, i-th one containing the maximal dot product for the i-th vector from the input rounded to 3 decimal places.