{"problem":{"name":"K. Keeping Rabbits","description":{"content":"DreamGrid is the keeper of $n$ rabbits. Initially, the $i$-th ($1 <= i <= n$) rabbit has a weight of $w_i$.  Every morning, DreamGrid gives the rabbits a carrot of weight $1$ and the rabbits fight fo","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10239K"},"statements":[{"statement_type":"Markdown","content":"DreamGrid is the keeper of $n$ rabbits. Initially, the $i$-th ($1 <= i <= n$) rabbit has a weight of $w_i$. \n\nEvery morning, DreamGrid gives the rabbits a carrot of weight $1$ and the rabbits fight for the only carrot. Only one rabbit wins the fight and eats the carrot. After that, the winner's weight increases by $1$. The whole process of fighting and eating ends before the next morning.\n\nDreamGrid finds that the heavier a rabbit is, the easier it is to win a fight. Formally, if the weights of the rabbits are $w_1 ', w_2 ', \\\\dots, w_n '$ before a fight, the probability that the $i$-th rabbit wins the fight is $$\\frac{w_i'}{\\sum\\limits_{j=1}^{n}{w_j'}}$$ He wants to know the expected weight of every rabbit after $k$ days ($k$ carrots are given and eaten).\n\nThe input contains multiple cases. The first line of the input contains a single integer $T \" \"(1 <= T <= 10^5)$, the number of cases.\n\nFor each case, the first line of the input contains two integers $n$ and $k$ ($1 <= n <= 10^5, 1 <= k <= 10^9$). The second line contains $n$ integers $w_1, w_2, \\\\dots, w_n$ ($1 <= i <= n, 1 <= w_i <= 10^9$).\n\nIt's guaranteed that the sum of $n$ over all cases doesn't exceed $10^6$.\n\nFor each case, print a single line containing $n$ space-separated real numbers, where the $i$-th ($1 <= i <= n$) number should be equal to the expected weight of the $i$-th rabbit after $k$ days.\n\nYour answer will be considered correct if the absolute or relative error does not exceed $10^(-4)$.\n\n## Input\n\nThe input contains multiple cases. The first line of the input contains a single integer $T \" \"(1 <= T <= 10^5)$, the number of cases.For each case, the first line of the input contains two integers $n$ and $k$ ($1 <= n <= 10^5, 1 <= k <= 10^9$). The second line contains $n$ integers $w_1, w_2, \\\\dots, w_n$ ($1 <= i <= n, 1 <= w_i <= 10^9$).It's guaranteed that the sum of $n$ over all cases doesn't exceed $10^6$.\n\n## Output\n\nFor each case, print a single line containing $n$ space-separated real numbers, where the $i$-th ($1 <= i <= n$) number should be equal to the expected weight of the $i$-th rabbit after $k$ days.Your answer will be considered correct if the absolute or relative error does not exceed $10^(-4)$.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case:  \n- Let $ n \\in \\mathbb{Z} $ be the number of rabbits.  \n- Let $ k \\in \\mathbb{Z} $ be the number of days (carrots given).  \n- Let $ \\mathbf{w} = (w_1, w_2, \\dots, w_n) \\in \\mathbb{R}_{>0}^n $ be the initial weights of the rabbits.  \n\nLet $ \\mathbf{W}^{(d)} = (W_1^{(d)}, W_2^{(d)}, \\dots, W_n^{(d)}) \\in \\mathbb{R}_{>0}^n $ denote the random vector of weights after $ d $ days, with $ \\mathbf{W}^{(0)} = \\mathbf{w} $.  \n\n**Constraints**  \n1. $ 1 \\le T \\le 10^5 $  \n2. For each test case:  \n   - $ 1 \\le n \\le 10^5 $, $ 1 \\le k \\le 10^9 $  \n   - $ 1 \\le w_i \\le 10^9 $ for all $ i \\in \\{1, \\dots, n\\} $  \n3. $ \\sum_{\\text{all cases}} n \\le 10^6 $  \n\n**Transition Rule**  \nAt day $ d+1 $, given current weights $ \\mathbf{W}^{(d)} $, the probability that rabbit $ i $ wins the fight is:  \n$$\n\\mathbb{P}(\\text{rabbit } i \\text{ wins} \\mid \\mathbf{W}^{(d)}) = \\frac{W_i^{(d)}}{\\sum_{j=1}^n W_j^{(d)}}\n$$  \nIf rabbit $ i $ wins, then:  \n$$\nW_i^{(d+1)} = W_i^{(d)} + 1, \\quad W_j^{(d+1)} = W_j^{(d)} \\text{ for } j \\ne i\n$$\n\n**Objective**  \nCompute the expected weight vector after $ k $ days:  \n$$\n\\mathbb{E}[\\mathbf{W}^{(k)}] = \\left( \\mathbb{E}[W_1^{(k)}], \\mathbb{E}[W_2^{(k)}], \\dots, \\mathbb{E}[W_n^{(k)}] \\right)\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10239K","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}