{"problem":{"name":"C. Tea Party","description":{"content":"Polycarp invited all his friends to the tea party to celebrate the holiday. He has _n_ cups, one for each of his _n_ friends, with volumes _a_1, _a_2, ..., _a__n_. His teapot stores _w_ milliliters of","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF808C"},"statements":[{"statement_type":"Markdown","content":"Polycarp invited all his friends to the tea party to celebrate the holiday. He has _n_ cups, one for each of his _n_ friends, with volumes _a_1, _a_2, ..., _a__n_. His teapot stores _w_ milliliters of tea (_w_ ≤ _a_1 + _a_2 + ... + _a__n_). Polycarp wants to pour tea in cups in such a way that:\n\n*   Every cup will contain tea for at least half of its volume\n*   Every cup will contain integer number of milliliters of tea\n*   All the tea from the teapot will be poured into cups\n*   All friends will be _satisfied_.\n\nFriend with cup _i_ won't be _satisfied_, if there exists such cup _j_ that cup _i_ contains less tea than cup _j_ but _a__i_ > _a__j_.\n\nFor each cup output how many milliliters of tea should be poured in it. If it's impossible to pour all the tea and satisfy all conditions then output _\\-1_.\n\n## Input\n\nThe first line contains two integer numbers _n_ and _w_ (1 ≤ _n_ ≤ 100, ).\n\nThe second line contains _n_ numbers _a_1, _a_2, ..., _a__n_ (1 ≤ _a__i_ ≤ 100).\n\n## Output\n\nOutput how many milliliters of tea every cup should contain. If there are multiple answers, print any of them.\n\nIf it's impossible to pour all the tea and satisfy all conditions then output _\\-1_.\n\n[samples]\n\n## Note\n\nIn the third example you should pour to the first cup at least 5 milliliters, to the second one at least 4, to the third one at least 5. It sums up to 14, which is greater than 10 milliliters available.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"Polycarp 邀请了他所有朋友来参加茶会庆祝节日。他有 #cf_span[n] 个杯子，每个朋友一个，容量分别为 #cf_span[a1, a2, ..., an]。他的茶壶装有 #cf_span[w] 毫升的茶（#cf_span[w ≤ a1 + a2 + ... + an]）。Polycarp 希望以如下方式将茶倒入杯子中：\n\n如果存在某个杯子 #cf_span[j]，使得杯子 #cf_span[i] 中的茶量少于杯子 #cf_span[j]，但 #cf_span[ai > aj]，则杯子 #cf_span[i] 的主人将不被满足。\n\n请为每个杯子输出应倒入的茶量（单位：毫升）。如果无法倒完所有茶且满足所有条件，则输出 _-1_。\n\n第一行包含两个整数 #cf_span[n] 和 #cf_span[w]（#cf_span[1 ≤ n ≤ 100]）。\n\n第二行包含 #cf_span[n] 个数 #cf_span[a1, a2, ..., an]（#cf_span[1 ≤ ai ≤ 100]）。\n\n请输出每个杯子应包含的茶量（单位：毫升）。如果有多种答案，输出任意一种即可。\n\n如果无法倒完所有茶且满足所有条件，则输出 _-1_。\n\n在第三个例子中，第一个杯子至少需要倒 5 毫升，第二个杯子至少需要倒 4 毫升，第三个杯子至少需要倒 5 毫升。总和为 14，超过了可用的 10 毫升。\n\n## Input\n\n第一行包含两个整数 #cf_span[n] 和 #cf_span[w]（#cf_span[1 ≤ n ≤ 100]）。第二行包含 #cf_span[n] 个数 #cf_span[a1, a2, ..., an]（#cf_span[1 ≤ ai ≤ 100]）。\n\n## Output\n\n请输出每个杯子应包含的茶量（单位：毫升）。如果有多种答案，输出任意一种即可。如果无法倒完所有茶且满足所有条件，则输出 _-1_。\n\n[samples]\n\n## Note\n\n在第三个例子中，第一个杯子至少需要倒 5 毫升，第二个杯子至少需要倒 4 毫升，第三个杯子至少需要倒 5 毫升。总和为 14，超过了可用的 10 毫升。","is_translate":true,"language":"Chinese"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of cups.  \nLet $ w \\in \\mathbb{Z}^+ $ be the total tea volume available.  \nLet $ A = (a_1, a_2, \\dots, a_n) \\in \\mathbb{Z}^n $ be the capacities of the cups, with $ a_i \\geq 1 $.  \nLet $ x = (x_1, x_2, \\dots, x_n) \\in \\mathbb{R}^n $ be the tea volume poured into each cup, with $ 0 \\leq x_i \\leq a_i $.\n\n**Constraints**  \n1. $ \\sum_{i=1}^n x_i = w $  \n2. For all $ i, j \\in \\{1, \\dots, n\\} $:  \n   If $ x_i < x_j $, then $ a_i \\leq a_j $  \n   (Equivalently: $ a_i > a_j \\Rightarrow x_i \\geq x_j $)\n\n**Objective**  \nFind any $ x \\in \\mathbb{R}^n $ satisfying the above constraints, or output $-1$ if no such $ x $ exists.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF808C","tags":["constructive algorithms","greedy","sortings"],"sample_group":[["2 10\n8 7","6 4"],["4 4\n1 1 1 1","1 1 1 1"],["3 10\n9 8 10","\\-1"]],"created_at":"2026-03-03 11:00:39"}}