Responsive image

问题 1863 --Hard challenge

1863: Hard challenge

时间限制: 4 Sec  内存限制: 128 MB
提交: 19  解决: 16
[提交][状态][讨论版][命题人:]

题目描述

There are n points on the plane, and the ith points has a value vali, and its coordinate is (xi,yi). It is guaranteed that no two points have the same coordinate, and no two points makes the line which passes them also passes the origin point. For every two points, there is a segment connecting them, and the segment has a value which equals the product of the values of the two points. Now HazelFan want to draw a line throgh the origin point but not through any given points, and he define the score is the sum of the values of all segments that the line crosses. Please tell him the maximum score.
 

输入描述

The first line contains a positive integer T(1≤T≤5), denoting the number of test cases.
For each test case:
The first line contains a positive integer n(1≤n≤5×10^4).
The next n lines, the ith line contains three integers xi,yi,vali(|xi|,|yi|≤10^9,1≤vali≤10^4).
 

输出描述

For each test case:
A single line contains a nonnegative integer, denoting the answer.
 

样例输入

2
2
1 1 1
1 -1 1
3
1 1 1
1 -1 10
-1 0 100

样例输出

1
1100

来源

 

[提交][状态]
ACM算法攻关部