|
||||||||||
Black MagicTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 607 Accepted Submission(s): 305 Problem Description HoshiYo is learning Black Magic with $n$ blocks. The left and right sides of each block are painted black or white. HoshiYo arranges the blocks in a row in a certain order without rotating them and then releases the Black Magic. Here's what happens next:
Input The first line contains an integer $T$ ($1 \le T \le 4\times 10^3$), indicating the number of test cases. Each test case contains four integers $E,L,R,B$ ($0 \le E,L,R,B \le 10^5, E+L+R+B\ge 1$), indicating the number of blocks.
Output For each test case, output two integers in a single line, indicating the minimum and maximum blocks HoshiYo can get. Sample Input
Sample Output
Hint Let's denote a block by $(x,y)$, where $x$ indicates the color on the left side, and $y$ indicates the color on the right side. We use $0$ to represent white and $1$ to represent black. For the first test case in the sample, here is a possible solution to get the minimum number of blocks: $$(0,0) \quad (0,1) \quad (1,1) \quad (1,0)$$ As shown above, the last three blocks will be pasted into one. And here is a possible solution to get the maximum number of blocks: $$(0,0) \quad (1,0) \quad (1,1) \quad (0,1)$$ As shown above, any two blocks will not be pasted together. Source | ||||||||||
|