{"problem":{"name":"[ICPC 2020 Nanjing R] Let's Play Curling","description":{"content":"Curling is a sport in which players slide stones on a sheet of ice toward a target area. The team with the nearest stone to the center of the target area wins the game. Two teams, Red and Blue, are c","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":{"LuoguStyle":"P3"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9633"},"statements":[{"statement_type":"Markdown","content":"Curling is a sport in which players slide stones on a sheet of ice toward a target area. The team with the nearest stone to the center of the target area wins the game.\n\nTwo teams, Red and Blue, are competing on the number axis. After the game there are $(n+m)$ stones remaining on the axis, $n$ of them for the Red team and the other $m$ of them for the Blue. The $i$-th stone of the Red team is positioned at $a_i$ and the $i$-th stone of the Blue team is positioned at $b_i$.\n\nLet $c$ be the position of the center of the target area. From the description above we know that if there exists some $i$ such that $1 \\le i \\le n$ and for all $1 \\le j \\le m$ we have $|c - a_i| < |c - b_j|$ then Red wins the game. What's more, Red is declared to win $p$ points if the number of $i$ satisfying the constraint is exactly $p$.\n\nGiven the positions of the stones for team Red and Blue, your task is to determine the position $c$ of the center of the target area so that Red wins the game and scores as much as possible. Note that $c$ can be any real number, not necessarily an integer.\n\n## Input\n\nThere are multiple test cases. The first line of the input contains an integer $T$ indicating the number of test cases. For each test case:\n\nThe first line contains two integers $n$ and $m$ ($1 \\le n, m \\le 10^5$) indicating the number of stones for Red and the number of stones for Blue.\n\nThe second line contains $n$ integers $a_1, a_2, \\cdots, a_n$ ($1 \\le a_i \\le 10^9$) indicating the positions of the stones for Red.\n\nThe third line contains $m$ integers $b_1, b_2, \\cdots, b_m$ ($1 \\le b_i \\le 10^9$) indicating the positions of the stones for Blue.\n\nIt's guaranteed that neither the sum of $n$ nor the sum of $m$ will exceed $5 \\times 10^5$.\n\n## Output\n\nFor each test case output one line. If there exists some $c$ so that Red wins and scores as much as possible, output one integer indicating the maximum possible $\\textbf{score}$ of Red (NOT $c$). Otherwise output ``Impossible`` (without quotes) instead.\n\n[samples]\n\n## Note\n\nFor the first sample test case we can assign $c = 2.5$ so that the stones at position 2 and 3 for Red will score.\n\nFor the second sample test case we can assign $c = 7$ so that the stones at position 5 and 7 for Red will score.","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9633","tags":["2020","O2优化","ICPC","南京"],"sample_group":[["3\n2 2\n2 3\n1 4\n6 5\n2 5 3 7 1 7\n3 4 3 1 10\n1 1\n7\n7","2\n3\nImpossible"]],"created_at":"2026-03-03 11:09:25"}}