luogu#P7821. 「RdOI R3」race
「RdOI R3」race
Problem Description
In a football tournament, Team A and Team B played a total of matches. The tournament uses a point system: the winning team gets points, the losing team gets points, and if the match is a draw then both teams get points each. It is known that Team A scored a total of goals, and Team B scored a total of goals. Find the maximum possible total score and the minimum possible total score for Team A.
Input Format
This problem contains multiple test cases.
The first line contains an integer , the number of test cases.
For each test case, input one line with six integers .
Output Format
For each test case, output one line with two integers separated by a space, representing the maximum possible total score and the minimum possible total score.
5
5 3 0 2 5 2
5 5 2 3 0 5
3 100 1 2 6 6
5 9 0 2 3 9
4 5 0 5 1 3
13 7
14 10
201 6
29 0
15 5
Hint
Sample Explanation
To make the samples easier to understand, the sample explanations for the first three test cases are given below:
| Test Case | Maximum Score Plan | Minimum Score Plan |
|---|---|---|
In the table, means the score of match is , the score of match is , and so on.
Constraints
This problem uses bundled testdata.
For all test cases, , , , .
| subtask | Score | Special Constraint | Dependencies |
|---|---|---|---|
| None | |||
| None |
Translated by ChatGPT 5