{"raw_statement":[{"iden":"statement","content":"Students love to celebrate their holidays. Especially if the holiday is the day of the end of exams!\n\nDespite the fact that Igor K., unlike his groupmates, failed to pass a programming test, he decided to invite them to go to a cafe so that each of them could drink a bottle of... fresh cow milk. Having entered the cafe, the _m_ friends found _n_ different kinds of milk on the menu, that's why they ordered _n_ bottles — one bottle of each kind. We know that the volume of milk in each bottle equals _w_.\n\nWhen the bottles were brought in, they decided to pour all the milk evenly among the _m_ cups, so that each got a cup. As a punishment for not passing the test Igor was appointed the person to pour the milk. He protested that he was afraid to mix something up and suggested to distribute the drink so that the milk from each bottle was in no more than two different cups. His friends agreed but they suddenly faced the following problem — and what is actually the way to do it?\n\nHelp them and write the program that will help to distribute the milk among the cups and drink it as quickly as possible!\n\nNote that due to Igor K.'s perfectly accurate eye and unswerving hands, he can pour any fractional amount of milk from any bottle to any cup."},{"iden":"input","content":"The only input data file contains three integers _n_, _w_ and _m_ (1 ≤ _n_ ≤ 50, 100 ≤ _w_ ≤ 1000, 2 ≤ _m_ ≤ 50), where _n_ stands for the number of ordered bottles, _w_ stands for the volume of each of them and _m_ stands for the number of friends in the company."},{"iden":"output","content":"Print on the first line \"_YES_\" if it is possible to pour the milk so that the milk from each bottle was in no more than two different cups. If there's no solution, print \"_NO_\".\n\nIf there is a solution, then print _m_ more lines, where the _i_\\-th of them describes the content of the _i_\\-th student's cup. The line should consist of one or more pairs that would look like \"_b_ _v_\". Each such pair means that _v_ (_v_ > 0) units of milk were poured into the _i_\\-th cup from bottle _b_ (1 ≤ _b_ ≤ _n_). All numbers _b_ on each line should be different.\n\nIf there are several variants to solve the problem, print any of them. Print the real numbers with no less than 6 digits after the decimal point."},{"iden":"examples","content":"Input\n\n2 500 3\n\nOutput\n\nYES\n1 333.333333\n2 333.333333\n2 166.666667 1 166.666667\n\nInput\n\n4 100 5\n\nOutput\n\nYES\n3 20.000000 4 60.000000\n1 80.000000\n4 40.000000 2 40.000000\n3 80.000000\n2 60.000000 1 20.000000\n\nInput\n\n4 100 7\n\nOutput\n\nNO\n\nInput\n\n5 500 2\n\nOutput\n\nYES\n4 250.000000 5 500.000000 2 500.000000\n3 500.000000 1 500.000000 4 250.000000"}],"translated_statement":[{"iden":"statement","content":"学生喜欢庆祝他们的假期，尤其是期末考试结束的日子！\n\n尽管 Igor K. 与他的同学们不同，未能通过编程测试，他仍决定邀请他们去咖啡馆，让每个人都能喝一瓶……新鲜的牛奶。进入咖啡馆后，这 #cf_span[m] 位朋友发现菜单上有 #cf_span[n] 种不同的牛奶，于是他们点了 #cf_span[n] 瓶——每种一瓶。我们知道每瓶牛奶的体积为 #cf_span[w]。\n\n当瓶子被端上来时，他们决定将所有牛奶平均分到 #cf_span[m] 个杯子中，每人一杯。由于没通过测试，Igor 被指定为倒牛奶的人。他担心会搞混，建议将饮料分配得使每瓶牛奶最多只倒入两个不同的杯子中。他的朋友们同意了，但他们随即面临一个问题——究竟该如何操作？\n\n请帮助他们编写一个程序，以分配牛奶并尽快喝掉它！\n\n注意：由于 Igor K. 拥有极其精准的视力和稳定的手，他可以从任意瓶子向任意杯子倒入任意小数体积的牛奶。\n\n输入文件仅包含三个整数 #cf_span[n], #cf_span[w] 和 #cf_span[m]（#cf_span[1 ≤ n ≤ 50], #cf_span[100 ≤ w ≤ 1000], #cf_span[2 ≤ m ≤ 50]），其中 #cf_span[n] 表示订购的瓶子数，#cf_span[w] 表示每瓶的体积，#cf_span[m] 表示朋友的人数。\n\n如果可以将牛奶分配，使得每瓶牛奶最多只出现在两个不同的杯子中，则在第一行输出 \"_YES_\"；若无解，则输出 \"_NO_\"。\n\n若有解，则再输出 #cf_span[m] 行，其中第 #cf_span[i] 行描述第 #cf_span[i] 位学生的杯子内容。每行应由一个或多个形如 \"#cf_span[b] #cf_span[v]\" 的数对组成。每个这样的数对表示有 #cf_span[v]（#cf_span[v > 0]）单位的牛奶从第 #cf_span[b] 瓶（#cf_span[1 ≤ b ≤ n]）倒入第 #cf_span[i] 个杯子。每行中的所有 #cf_span[b] 数字必须互不相同。\n\n若有多种解法，输出任意一种即可。实数输出时小数点后至少保留 6 位。\n"},{"iden":"input","content":"输入文件仅包含三个整数 #cf_span[n], #cf_span[w] 和 #cf_span[m]（#cf_span[1 ≤ n ≤ 50], #cf_span[100 ≤ w ≤ 1000], #cf_span[2 ≤ m ≤ 50]），其中 #cf_span[n] 表示订购的瓶子数，#cf_span[w] 表示每瓶的体积，#cf_span[m] 表示朋友的人数。"},{"iden":"output","content":"如果可以将牛奶分配，使得每瓶牛奶最多只出现在两个不同的杯子中，则在第一行输出 \"_YES_\"；若无解，则输出 \"_NO_\"。若有解，则再输出 #cf_span[m] 行，其中第 #cf_span[i] 行描述第 #cf_span[i] 位学生的杯子内容。每行应由一个或多个形如 \"#cf_span[b] #cf_span[v]\" 的数对组成。每个这样的数对表示有 #cf_span[v]（#cf_span[v > 0]）单位的牛奶从第 #cf_span[b] 瓶（#cf_span[1 ≤ b ≤ n]）倒入第 #cf_span[i] 个杯子。每行中的所有 #cf_span[b] 数字必须互不相同。若有多种解法，输出任意一种即可。实数输出时小数点后至少保留 6 位。"},{"iden":"examples","content":"输入\n2 500 3\n输出\nYES\n1 333.333333\n2 333.333333\n2 166.666667 1 166.666667\n\n输入\n4 100 5\n输出\nYES\n3 20.000000 4 60.000000\n1 80.000000\n4 40.000000 2 40.000000\n3 80.000000\n2 60.000000 1 20.000000\n\n输入\n4 100 7\n输出\nNO\n\n输入\n5 500 2\n输出\nYES\n4 250.000000 5 500.000000 2 500.000000\n3 500.000000 1 500.000000 4 250.000000"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions:**\n\n- Let $ n $: number of bottles, each of volume $ w $.\n- Let $ m $: number of cups (students).\n- Total milk volume: $ T = n \\cdot w $.\n- Each cup must receive $ \\frac{T}{m} = \\frac{n \\cdot w}{m} $ volume of milk.\n\n**Constraints:**\n\n- Each bottle’s milk must be distributed to **at most two** cups.\n- All milk must be distributed (no waste).\n- Each cup receives exactly $ \\frac{n \\cdot w}{m} $ volume.\n- All pours are non-negative real numbers.\n\n**Objective:**\n\nDetermine whether a distribution exists such that:\n\n1. $ \\sum_{i=1}^m \\text{volume in cup } i = n \\cdot w $,\n2. Each cup $ i $ receives exactly $ \\frac{n \\cdot w}{m} $,\n3. For each bottle $ b \\in \\{1, \\dots, n\\} $, the milk from bottle $ b $ is poured into **at most two** cups.\n\n---\n\n**Mathematical Formulation:**\n\nLet $ x_{b,i} \\in \\mathbb{R}_{\\geq 0} $ be the volume of milk from bottle $ b $ poured into cup $ i $.\n\n**Constraints:**\n\n1. **Total per bottle:**  \n   $$\n   \\sum_{i=1}^m x_{b,i} = w, \\quad \\forall b \\in \\{1, \\dots, n\\}\n   $$\n\n2. **Total per cup:**  \n   $$\n   \\sum_{b=1}^n x_{b,i} = \\frac{n \\cdot w}{m}, \\quad \\forall i \\in \\{1, \\dots, m\\}\n   $$\n\n3. **Sparsity per bottle (at most two cups per bottle):**  \n   $$\n   \\left| \\left\\{ i \\in \\{1, \\dots, m\\} : x_{b,i} > 0 \\right\\} \\right| \\leq 2, \\quad \\forall b \\in \\{1, \\dots, n\\}\n   $$\n\n---\n\n**Feasibility Condition:**\n\nThe problem is feasible **if and only if** $ \\frac{n \\cdot w}{m} \\leq 2w $, i.e., $ \\frac{n}{m} \\leq 2 $, or equivalently:\n\n$$\nn \\leq 2m\n$$\n\n**Justification:**\n\n- Each cup must receive $ \\frac{n w}{m} $.\n- Each bottle can contribute to at most two cups.\n- The maximum amount of milk any single cup can receive from one bottle is $ w $.\n- So, to fill a cup to $ \\frac{n w}{m} $, we need at most two bottles per cup → total capacity per cup is at most $ 2w $.\n- Therefore, necessary condition: $ \\frac{n w}{m} \\leq 2w \\Rightarrow n \\leq 2m $.\n\nThis condition is also **sufficient**: when $ n \\leq 2m $, a valid distribution exists and can be constructed greedily (e.g., by matching bottles to cups in a round-robin or two-per-cup fashion).\n\n---\n\n**Output Format:**\n\n- If $ n > 2m $: print `\"NO\"`\n- Else: print `\"YES\"`, then $ m $ lines, each listing pairs $ (b, v) $ for bottle $ b $ and volume $ v > 0 $ poured into that cup, with all $ b $ distinct per line.\n\n---\n\n**Final Formal Statement:**\n\nGiven integers $ n, w, m $ with $ 1 \\leq n \\leq 50 $, $ 100 \\leq w \\leq 1000 $, $ 2 \\leq m \\leq 50 $:\n\n- Let $ T = n \\cdot w $, $ c = \\frac{T}{m} $.\n- **Feasibility condition:** $ n \\leq 2m $\n- **If $ n > 2m $:** output `\"NO\"`\n- **Else:** output `\"YES\"` and construct a matrix $ X = [x_{b,i}] \\in \\mathbb{R}_{\\geq 0}^{n \\times m} $ such that:\n  - $ \\sum_{i=1}^m x_{b,i} = w $ for all $ b \\in [n] $\n  - $ \\sum_{b=1}^n x_{b,i} = c $ for all $ i \\in [m] $\n  - $ |\\{ i : x_{b,i} > 0 \\}| \\leq 2 $ for all $ b \\in [n] $\n\nConstructive algorithm (for sufficiency):  \nUse a greedy matching:  \n- Each cup needs $ c = \\frac{n w}{m} $.  \n- Since $ c \\leq 2w $, each cup can be filled by milk from at most two bottles.  \n- Assign bottles to cups such that no bottle is used in more than two cups (possible since total \"bottle-uses\" = $ n $, and total \"cup-capacities\" = $ m $, each can take up to 2 → total capacity $ 2m \\geq n $).\n\nA simple construction:  \n- Let each cup $ i $ receive milk from bottles in a cyclic manner.  \n- For $ i = 1 $ to $ m $:  \n  - Assign bottle $ b = \\lfloor \\frac{i-1}{2} \\rfloor + 1 $ and $ b = \\lfloor \\frac{i-1}{2} \\rfloor + 1 + m $ if needed, but better to use a flow-based assignment.  \n- Alternatively:  \n  - Let $ k = \\lfloor \\frac{n}{m} \\rfloor $, $ r = n \\mod m $.  \n  - Then $ r $ cups get $ k+1 $ bottles, $ m - r $ get $ k $ bottles.  \n  - But since each bottle can go to two cups, we can model as a bipartite graph with bottles on one side (each degree ≤ 2), cups on the other (each degree ≥ 1, sum of degrees = n), and total demand per cup = $ c $.  \n  - This is always feasible if $ n \\leq 2m $, and a constructive algorithm exists.\n\nFor simplicity in code:  \n- Use two arrays: `cup_load[i] = 0` for each cup $ i $, target $ c $.  \n- For each bottle $ b = 1 $ to $ n $:  \n  - Find the first cup $ i $ with $ \\text{cup\\_load}[i] < c $, pour $ \\min(w, c - \\text{cup\\_load}[i]) $ into it.  \n  - If bottle still has milk left, pour remaining into next cup with space.  \n- Since $ \\sum \\text{cup\\_load} = n w $, and each cup needs $ c $, and $ n \\leq 2m $, this greedy will always work.\n\n---\n\n**Final Answer (Formal Output Only):**\n\nIf $ n > 2m $:  \n```\nNO\n```\n\nElse:  \n```\nYES\n```\nFollowed by $ m $ lines. For each cup $ i $, list all pairs $ (b, v) $ such that $ v = x_{b,i} > 0 $, with $ \\sum v = \\frac{n w}{m} $, and all $ b $ distinct per line. Use sufficient precision (≥6 decimal digits).","simple_statement":null,"has_page_source":false}