{"raw_statement":[{"iden":"statement","content":"_Nian is a monster which lives deep in the oceans. Once a year, it shows up on the land, devouring livestock and even people. In order to keep the monster away, people fill their villages with red colour, light, and cracking noise, all of which frighten the monster out of coming._\n\nLittle Tommy has _n_ lanterns and Big Banban has _m_ lanterns. Tommy's lanterns have brightness _a_1, _a_2, ..., _a__n_, and Banban's have brightness _b_1, _b_2, ..., _b__m_ respectively.\n\nTommy intends to hide one of his lanterns, then Banban picks one of Tommy's non-hidden lanterns and one of his own lanterns to form a pair. The pair's brightness will be the product of the brightness of two lanterns.\n\nTommy wants to make the product as small as possible, while Banban tries to make it as large as possible.\n\nYou are asked to find the brightness of the chosen pair if both of them choose optimally."},{"iden":"input","content":"The first line contains two space-separated integers _n_ and _m_ (2 ≤ _n_, _m_ ≤ 50).\n\nThe second line contains _n_ space-separated integers _a_1, _a_2, ..., _a__n_.\n\nThe third line contains _m_ space-separated integers _b_1, _b_2, ..., _b__m_.\n\nAll the integers range from  - 109 to 109."},{"iden":"output","content":"Print a single integer — the brightness of the chosen pair."},{"iden":"examples","content":"Input\n\n2 2\n20 18\n2 14\n\nOutput\n\n252\n\nInput\n\n5 3\n-1 0 1 2 3\n-1 0 1\n\nOutput\n\n2"},{"iden":"note","content":"In the first example, Tommy will hide 20 and Banban will choose 18 from Tommy and 14 from himself.\n\nIn the second example, Tommy will hide 3 and Banban will choose 2 from Tommy and 1 from himself."}],"translated_statement":[{"iden":"statement","content":"_Nian_ 是一种生活在深海中的怪物。每年它都会现身陆地，吞噬牲畜甚至人类。为了驱赶这只怪物，人们用红色、灯光和爆裂的声响充满村庄，所有这些都能吓跑怪物。\n\n小汤米有 #cf_span[n] 个灯笼，大斑斑有 #cf_span[m] 个灯笼。汤米的灯笼亮度为 #cf_span[a1, a2, ..., an]，斑斑的灯笼亮度为 #cf_span[b1, b2, ..., bm]。\n\n汤米打算隐藏他其中一个灯笼，然后斑斑从汤米未隐藏的灯笼中选择一个，再从自己的灯笼中选择一个，组成一对。这对灯笼的亮度是两个灯笼亮度的乘积。\n\n汤米希望使乘积尽可能小，而斑斑则希望使其尽可能大。\n\n请你求出，当双方都采取最优策略时，最终选出的这对灯笼的亮度是多少。\n\n第一行包含两个用空格分隔的整数 #cf_span[n] 和 #cf_span[m]（#cf_span[2 ≤ n, m ≤ 50]）。\n\n第二行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[a1, a2, ..., an]。\n\n第三行包含 #cf_span[m] 个用空格分隔的整数 #cf_span[b1, b2, ..., bm]。\n\n所有整数的范围为 #cf_span[ - 109] 到 #cf_span[109]。\n\n请输出一个整数 —— 所选这对灯笼的亮度。\n\n在第一个例子中，汤米会隐藏 #cf_span[20]，斑斑会从汤米那里选择 #cf_span[18]，从自己那里选择 #cf_span[14]。\n\n在第二个例子中，汤米会隐藏 #cf_span[3]，斑斑会从汤米那里选择 #cf_span[2]，从自己那里选择 #cf_span[1]。"},{"iden":"input","content":"第一行包含两个用空格分隔的整数 #cf_span[n] 和 #cf_span[m]（#cf_span[2 ≤ n, m ≤ 50]）。第二行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[a1, a2, ..., an]。第三行包含 #cf_span[m] 个用空格分隔的整数 #cf_span[b1, b2, ..., bm]。所有整数的范围为 #cf_span[ - 109] 到 #cf_span[109]。"},{"iden":"output","content":"请输出一个整数 —— 所选这对灯笼的亮度。"},{"iden":"examples","content":"输入\n2 2\n20 18\n2 14\n输出\n252\n\n输入\n5 3\n-1 0 1 2 3\n-1 0 1\n输出\n2"},{"iden":"note","content":"在第一个例子中，汤米会隐藏 #cf_span[20]，斑斑会从汤米那里选择 #cf_span[18]，从自己那里选择 #cf_span[14]。在第二个例子中，汤米会隐藏 #cf_span[3]，斑斑会从汤米那里选择 #cf_span[2]，从自己那里选择 #cf_span[1]。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, m \\in \\mathbb{Z} $ with $ 2 \\leq n, m \\leq 50 $.  \nLet $ A = (a_1, a_2, \\dots, a_n) \\in \\mathbb{Z}^n $ be Tommy’s lantern brightnesses.  \nLet $ B = (b_1, b_2, \\dots, b_m) \\in \\mathbb{Z}^m $ be Banban’s lantern brightnesses.  \n\n**Constraints**  \n$ -10^9 \\leq a_i, b_j \\leq 10^9 $ for all $ i \\in \\{1,\\dots,n\\}, j \\in \\{1,\\dots,m\\} $.\n\n**Objective**  \nTommy chooses an index $ i^* \\in \\{1,\\dots,n\\} $ to hide (removing $ a_{i^*} $ from consideration).  \nThen Banban chooses $ i \\in \\{1,\\dots,n\\} \\setminus \\{i^*\\} $ and $ j \\in \\{1,\\dots,m\\} $ to maximize $ a_i \\cdot b_j $.  \nTommy chooses $ i^* $ to minimize this maximum value.  \n\nFind:  \n$$\n\\min_{i^* \\in \\{1,\\dots,n\\}} \\max_{\\substack{i \\in \\{1,\\dots,n\\} \\\\ i \\ne i^*}} \\max_{j \\in \\{1,\\dots,m\\}} (a_i \\cdot b_j)\n$$","simple_statement":null,"has_page_source":false}