{"raw_statement":[{"iden":"statement","content":"Jafar has _n_ cans of cola. Each can is described by two integers: remaining volume of cola _a__i_ and can's capacity _b__i_ (_a__i_  ≤  _b__i_).\n\nJafar has decided to pour all remaining cola into just 2 cans, determine if he can do this or not!"},{"iden":"input","content":"The first line of the input contains one integer _n_ (2 ≤ _n_ ≤ 100 000) — number of cola cans.\n\nThe second line contains _n_ space-separated integers _a_1, _a_2, ..., _a__n_ (0 ≤ _a__i_ ≤ 109) — volume of remaining cola in cans.\n\nThe third line contains _n_ space-separated integers that _b_1, _b_2, ..., _b__n_ (_a__i_ ≤ _b__i_ ≤ 109) — capacities of the cans."},{"iden":"output","content":"Print \"_YES_\" (without quotes) if it is possible to pour all remaining cola in 2 cans. Otherwise print \"_NO_\" (without quotes).\n\nYou can print each letter in any case (upper or lower)."},{"iden":"examples","content":"Input\n\n2\n3 5\n3 6\n\nOutput\n\nYES\n\nInput\n\n3\n6 8 9\n6 10 12\n\nOutput\n\nNO\n\nInput\n\n5\n0 0 5 0 0\n1 1 8 10 5\n\nOutput\n\nYES\n\nInput\n\n4\n4 1 0 3\n5 2 2 3\n\nOutput\n\nYES"},{"iden":"note","content":"In the first sample, there are already 2 cans, so the answer is \"_YES_\"."}],"translated_statement":[{"iden":"statement","content":"Jafar 有 #cf_span[n] 罐可乐。每罐可乐由两个整数描述：剩余可乐体积 #cf_span[ai] 和罐的容量 #cf_span[bi]（#cf_span[ai] #cf_span[ ≤ ] #cf_span[bi]）。\n\nJafar 决定将所有剩余可乐倒入恰好 #cf_span[2] 个罐中，请判断他是否能做到！\n\n输入的第一行包含一个整数 #cf_span[n]（#cf_span[2 ≤ n ≤ 100 000]）— 可乐罐的数量。\n\n第二行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[a1, a2, ..., an]（#cf_span[0 ≤ ai ≤ 10^9]）— 每罐中剩余可乐的体积。\n\n第三行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[b1, b2, ..., bn]（#cf_span[ai ≤ bi ≤ 10^9]）— 每罐的容量。\n\n如果可以将所有剩余可乐倒入 #cf_span[2] 个罐中，请输出 \"_YES_\"（不含引号）；否则输出 \"_NO_\"（不含引号）。\n\n你可以以任意大小写形式输出每个字母。\n\n在第一个样例中，已有 #cf_span[2] 个罐，因此答案为 \"_YES_\"。\n\n"},{"iden":"input","content":"输入的第一行包含一个整数 #cf_span[n]（#cf_span[2 ≤ n ≤ 100 000]）— 可乐罐的数量。第二行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[a1, a2, ..., an]（#cf_span[0 ≤ ai ≤ 10^9]）— 每罐中剩余可乐的体积。第三行包含 #cf_span[n] 个用空格分隔的整数 #cf_span[b1, b2, ..., bn]（#cf_span[ai ≤ bi ≤ 10^9]）— 每罐的容量。"},{"iden":"output","content":"如果可以将所有剩余可乐倒入 #cf_span[2] 个罐中，请输出 \"_YES_\"（不含引号）；否则输出 \"_NO_\"（不含引号）。你可以以任意大小写形式输出每个字母。"},{"iden":"examples","content":"输入\n2\n3 5\n3 6\n输出\nYES\n\n输入\n3\n6 8 9\n6 10 12\n输出\nNO\n\n输入\n5\n0 0 5 0 0\n1 1 8 10 5\n输出\nYES\n\n输入\n4\n4 1 0 3\n5 2 2 3\n输出\nYES"},{"iden":"note","content":"在第一个样例中，已有 #cf_span[2] 个罐，因此答案为 \"_YES_\"。"}],"sample_group":[],"show_order":[],"formal_statement":"Let $ n $ be the number of cans.  \nLet $ a_i $ be the remaining volume of cola in can $ i $, and $ b_i $ be its capacity, for $ i = 1, 2, \\dots, n $, with $ 0 \\leq a_i \\leq b_i $.  \n\nLet $ S = \\sum_{i=1}^n a_i $ be the total remaining volume of cola.\n\nDetermine whether there exist two distinct cans $ j $ and $ k $ (with $ 1 \\leq j < k \\leq n $) such that:  \n$$\na_j + a_k + \\sum_{\\substack{i=1 \\\\ i \\neq j,k}}^n a_i \\leq b_j + b_k\n$$  \nEquivalently:  \n$$\nS \\leq b_j + b_k\n$$\n\nThat is, determine if there exist two cans whose combined capacity is at least the total volume of cola.\n\n**Objective:**  \nCheck whether $ \\max_{1 \\leq j < k \\leq n} (b_j + b_k) \\geq S $.\n\nEquivalently, let $ b_{(1)} \\geq b_{(2)} \\geq \\dots \\geq b_{(n)} $ be the capacities sorted in non-increasing order.  \nThen the maximum possible sum of two capacities is $ b_{(1)} + b_{(2)} $.  \n\nThus, the condition simplifies to:  \n$$\nb_{(1)} + b_{(2)} \\geq S\n$$\n\n**Answer:**  \nYES if $ b_{(1)} + b_{(2)} \\geq \\sum_{i=1}^n a_i $, otherwise NO.","simple_statement":null,"has_page_source":false}