{"raw_statement":[{"iden":"problem statement","content":"You are given positive integers $x_1, \\ldots, x_N$ such that $x_1 < \\cdots < x_N$, and positive integers $y_1, \\ldots, y_N$.\nConsider a tuple $(M, L_1, R_1, \\ldots, L_M, R_M)$ that satisfies all of the following conditions.\n\n*   $M$ is a positive integer.\n*   For each $j \\ (1\\leq j\\leq M)$, $L_j$ and $R_j$ are integers such that $L_j\\leq R_j$.\n*   For each $i \\ (1\\leq i\\leq N)$, exactly $y_i$ integers $j \\ (1\\leq j\\leq M)$ satisfy $L_j\\leq x_i\\leq R_j$.\n\nIt can be proved that such a tuple always exists. Find the maximum value of $\\min \\lbrace R_j-L_j\\mid 1\\leq j\\leq M\\rbrace$ for such a tuple. If there is no maximum value, print `-1`."},{"iden":"constraints","content":"*   $1\\leq N\\leq 2\\times 10^5$\n*   $1\\leq x_1 < \\cdots < x_N \\leq 10^9$\n*   $1\\leq y_i \\leq 10^9$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$x_1$ $\\cdots$ $x_N$\n$y_1$ $\\cdots$ $y_N$"},{"iden":"sample input 1","content":"3\n1 3 5\n1 3 1"},{"iden":"sample output 1","content":"2\n\nFor example, we have $\\min \\lbrace R_j-L_j\\mid 1\\leq j\\leq M\\rbrace = 2$ for the tuple $(3, 1, 4, 2, 4, 3, 5)$."},{"iden":"sample input 2","content":"3\n1 10 100\n2 3 2"},{"iden":"sample output 2","content":"\\-1\n\nFor example, we have $\\min \\lbrace R_j-L_j\\mid 1\\leq j\\leq M\\rbrace = 990$ for the tuple $(3, -1000, 10, -1000, 1000, 10, 1000)$. There is no maximum value of $\\min \\lbrace R_j-L_j\\mid 1\\leq j\\leq M\\rbrace$."},{"iden":"sample input 3","content":"7\n10 31 47 55 68 73 90\n3 7 4 6 3 4 4"},{"iden":"sample output 3","content":"56"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}