题目描述
Alice and Bob are playing a little game. There are n stones. Alice and Bob take turns picking
stones, with Alice going first. Each person can only pick one stone at a time until all the stones
are gone. Each stone has two attributes, Ai and Bi . When Alice picks a stone, she earns Ai points, and when Bob picks a stone, he earns Bi points. The total score for each person is
the sum of the points they earn when picking a stone. Both pla
输入
The first line contains a positive integer, T, representing the number of test cases, where
1 ≤ T ≤ 20.
Next, for each test case, the following format is repeated: The first line contains a positive integer, n, where 1 ≤ n ≤ 1e5 .
The next n lines contain two integers, Ai and Bi , representing the two attributes of the ith stone. The values of Ai and Bi satisfy 0 ≤ Ai , Bi ≤ 1e9
Next, for each test case, the following format is repeated: The first line contains a positive integer, n, where 1 ≤ n ≤ 1e5 .
The next n lines contain two integers, Ai and Bi , representing the two attributes of the ith stone. The values of Ai and Bi satisfy 0 ≤ Ai , Bi ≤ 1e9
输出
For each test case, output one line containing an integer representing the answer.
样例输入 Copy
2
3
0 2
1 2
3 3
3
1 0
2 3
0 4
样例输出 Copy
1
-1