#546. 「Nowcoder多校 2019 Day1」Points Division
「Nowcoder多校 2019 Day1」Points Division
题目描述
Bobo has a set P of n distinct points .
The i-th point has two weights and .
He wants to partition the points into two sets A and B (That is, and .
A partition (A, B) is valid if and only if there exists no and where and .
Find the maximum of $ \left(\sum_{i \in A} a_i \right) + \left(\sum_{j \in B} b_j\right) $ among all valid partitions (A, B).
输入格式
The input consists of several test cases and is terminated by end-of-file.
The first line of each test cases contains an integer n. The i-th of the following n lines contains four integers .
- for all
- The sum of n does not exceed .
输出格式
For each test case, print an integer which denotes the result.
样例
样例输入
2
1 2 1 9
2 1 9 1
1
1 1 2 3
4
1 1 1 5
1 2 2 6
2 1 3 7
2 2 4 8
样例输出
10
3
26