{"problem":{"name":"Uniform Sum","description":{"content":"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 =","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":5000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc195_b"},"statements":[{"statement_type":"Markdown","content":"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:\n\n*   Choose an index $i$ such that $A_i = -1$, and replace $A_i$ with any non-negative integer.\n*   Choose an index $i$ such that $B_i = -1$, and replace $B_i$ with any non-negative integer.\n*   Rearrange the elements of sequence $A$ in any order.\n\nDetermine 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$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 2000$\n*   $-1 \\leq A_i \\leq 10^9$\n*   $-1 \\leq B_i \\leq 10^9$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\ldots$ $A_N$\n$B_1$ $B_2$ $\\ldots$ $B_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc195_b","tags":[],"sample_group":[["4\n2 0 -1 3\n3 -1 4 2","Yes\n\nConsider the following operations:\n\n*   Replace $A_3$ with $1$.\n*   Replace $B_2$ with $1$.\n*   Rearrange $A$ to $(1,3,0,2)$.\n\nAfter 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."],["3\n1 2 3\n1 2 4","No\n\nNo matter how you perform the operations, it is impossible to satisfy $A_1+B_1 = A_2+B_2 = A_3+B_3$."],["3\n1 2 -1\n1 2 4","No"]],"created_at":"2026-03-03 11:01:14"}}