AT_arc195_b [ARC195B] Uniform Sum
Description
There are two sequences $ A=(A_1,\dots,A_N) $ and $ B=(B_1,\dots,B_N) $ . You can perform the following three types of operations any number of times in any order:
- Choose an index $ i $ such that $ A_i = -1 $ , and replace $ A_i $ with any non-negative integer.
- Choose an index $ i $ such that $ B_i = -1 $ , and replace $ B_i $ with any non-negative integer.
- Rearrange the elements of sequence $ A $ in any order.
Determine whether it is possible, after these operations, for all elements of $ A $ and $ B $ to be non-negative and satisfy $ A_1 + B_1 = A_2 + B_2 = \dots = A_N + B_N $ .
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_N $ $ B_1 $ $ B_2 $ $ \ldots $ $ B_N $
Output Format
If it is possible, after the operations, for all elements of $ A $ and $ B $ to be non-negative and satisfy $ A_1 + B_1 = A_2 + B_2 = \dots = A_N + B_N $ , print `Yes`. Otherwise, print `No`.
Explanation/Hint
### Sample Explanation 1
Consider the following operations:
- Replace $ A_3 $ with $ 1 $ .
- Replace $ B_2 $ with $ 1 $ .
- Rearrange $ A $ to $ (1,3,0,2) $ .
After these operations, $ A = (1,3,0,2) $ and $ B = (3,1,4,2) $ : all elements of $ A $ and $ B $ are non-negative, and $ A_1+B_1 = A_2+B_2 = A_3+B_3 = A_4+B_4 = 4 $ is satisfied.
### Sample Explanation 2
No matter how you perform the operations, it is impossible to satisfy $ A_1+B_1 = A_2+B_2 = A_3+B_3 $ .
### Constraints
- $ 2 \leq N \leq 2000 $
- $ -1 \leq A_i \leq 10^9 $
- $ -1 \leq B_i \leq 10^9 $
- All input values are integers.