{"problem":{"name":"I. Rats","description":{"content":"Douglas is asking for your help to estimate the total number of rats in his area. Looking up in your statistics textbook, you propose using the Chapman estimator $hat(N)$, given by: $$ \\widehat{N} = \\","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10250I"},"statements":[{"statement_type":"Markdown","content":"Douglas is asking for your help to estimate the total number of rats in his area. Looking up in your statistics textbook, you propose using the Chapman estimator $hat(N)$, given by: $$ \\widehat{N} = \\left\\lfloor \\frac{(n_1+1)(n_2+1)}{n_{12}+1} -1\\right\\rfloor $$ where $floor.l x floor.r$ is the #cf_span(class=[tex-font-style-underline], body=[floor]) of a real number $x$, i.e., the closest integer less than or equal to $x$.\n\nThe input consists of a single line, with three space-separated integers: $n_1$, $n_2$, $n_(12)$, in that order.\n\n*Limits* \n\nThe output should contain a single line with the single integer $hat(N)$.\n\n## Input\n\nThe input consists of a single line, with three space-separated integers: $n_1$, $n_2$, $n_{12}$, in that order.*Limits*   $0 <= n_1, n_2 <= 10000$;  $0 <= n_{12} <= min (n_1, n_2)$. \n\n## Output\n\nThe output should contain a single line with the single integer $hat(N)$.\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, k \\in \\mathbb{Z} $ denote the number of people and shopkeepers, respectively.  \n- Let $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of positive integers, where $ a_i $ is the number of kiping requested by person $ i $.  \n\nLet $ \\mathcal{P} $ be the set of all partitions of $ A $ into $ k $ ordered lists (lines), where each person appears in exactly one line.  \n\n**Constraints**  \n1. $ 1 \\le t \\le 100 $  \n2. $ 1 \\le n \\le 10^5 $, $ 1 \\le k \\le 10^5 $  \n3. $ 1 \\le a_i \\le 10^9 $  \n4. The sum of all $ n $ across test cases is $ \\le 10^5 $  \n\n**Objective**  \nFor each test case, compute:  \n\n1. **Minimum total waiting time**:  \n   $$\n   \\min_{\\mathcal{P}} \\sum_{\\ell=1}^{k} \\sum_{j=2}^{|\\ell|} \\left( \\sum_{i=1}^{j-1} a_{\\ell_i} \\right)\n   $$  \n   where $ \\ell $ is a line (ordered list) of people, and $ \\ell_i $ is the $ i $-th person in line $ \\ell $.  \n\n2. **Number of distinct arrangements achieving the minimum total waiting time**, modulo $ 10^9 + 7 $.  \n\n**Note**: The waiting time of a person is the sum of the $ a_i $ of all people ahead of them in their line. The total waiting time is the sum over all people.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10250I","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}