{"problem":{"name":"J. Aufbau","description":{"content":"You are a student of the Academy for Covert Missions, currently #cf_span(class=[tex-font-style-underline], body=[not]) doing your chemistry homework. Now, chemistry can be useful to secret agents in m","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10253J"},"statements":[{"statement_type":"Markdown","content":"You are a student of the Academy for Covert Missions, currently #cf_span(class=[tex-font-style-underline], body=[not]) doing your chemistry homework. Now, chemistry can be useful to secret agents in many ways – gunpowder, smoke bombs, poison – but you don't care about any of that. You want to be a Hacker Agent, the enigmatic guy in the hoodie watching various UI elements pop up on the screen, the guy spewing technical terms while rapidly hacking on the back of a speeding motorcycle. That's why you're going to make a computer program to do your homework for you!\n\nAn atom has one or more electron shells, and each shell itself has one or more subshells. The electrons of an atom are distributed across its different shells within the different subshells. The Aufbau Principle dictates how these electrons are distributed, which is called its electron configuration.\n\nAn example electron configuration is that of Oxygen (O), which is $1 s^2$ $2 s^2$ $2 p^4$. This means:\n\nAs in the example, the electron configuration of an element is represented by a series of terms of the form $n l^e$, where:\n\nThe corresponding letters/labels for each subshell are:\n\n$$\\begin{array}{|r|rrrr|} \\hline \\ell & 0 & 1 & 2 & 3 \\\\ \\hline l & s & p & d & f \\\\ \\hline \\end{array}$$\n\nEach shell of an atom has a maximum number of subshells – in fact, the $n$th shell can have up to $n$ subshells (thus, $0 <= ell < n$, always).\n\nEach subshell of an atom has a maximum \"_capacity_\" – in other words, it can only fit a specific number of electrons. This capacity is determined solely by its $l$, in particular: $2 (2 ell + 1)$. Thus, the $3 p$ subshell can fit $2 (2 dot.op 1 + 1) = 6$ electrons, the $2 p$ subshell can also fit $6$ electrons, while the $4 d$ subshell can fit $2 (2 dot.op 2 + 1) = 10$ electrons.\n\nThe Aufbau Principle states that the electrons of an atom fill up subshells (to their capacity) in order of increasing $n + ell$, and in ties, by increasing $n$, as illustrated in this diagram: \n\nFor example, Hydrogen, with 1 electron, fills the zeroth subshell in the first shell with its lone electron. Thus, its electron configuration is $1 s^1$. Helium, with 2 electrons, will fill the zeroth subshell with both of its electrons, making its configuration $1 s^2$. Lithium, with 3 electrons, will fill up the zeroth subshell in the first shell, then fill the first subshell in the second shell, making it $1 s^2$ $2 s^1$. Potassium, the 19th element and thus 19 electrons, will have the following configuration: $1 s^2$ $2 s^2$ $2 p^6$ $3 s^2$ $3 p^6$ $4 s^1$.\n\nSeeing this pattern, you figure out that you could make a simple program for this. You can even generalize it to the $10^(15)$th element! You hope that there are no exceptions to the Aufbau Principle. (Spoiler: there are, but you don't really care enough about chemistry to address them.) Also, for $ell > 3$, you're not really sure what happens, but you are just going to assume that the rest of the alphabet after 'f' (excluding 's' and 'p') will be used. That is, we will use the following extended table of levels: $$ \\begin{array}{|r|rrrrrrrrrr} \\hline \\ell & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & \\ldots \\\\ \\hline l & s & p & d & f & g & h & i & j & k & \\ldots \\\\ \\hline \\end{array}$$ Remember that 's' and 'p' are skipped.\n\nOnce you reach 'z', you will use two-letter labels without skipping any letters this time. Specifically, you will use all possible two-letter combinations in lexicographical order (aa, ab, ac, ..., az, ba, bb, ..., ca, ..., zz).\n\nAfter 'zz', all three-letter combinations (aaa, aab, ..., zzz) will be used as labels, and so on.\n\nYou therefore \"extend\" the pattern as follows:\n\nNow, given an atomic number (which is the same as its number of electrons), can you find the last electron shell, last subshell and number of electrons in the last shell in its electron configuration? In other words, what is the last \"$n l^e$\"? For example, if the given atomic number is $19$, then the answer should be $4 s^1$.\n\nOutput the answer as $n$, $l$, $e$ in a single line NOT separated by spaces. For example, for $19$, output _4s1_.\n\nThe first line of input contains $t$, the number of test cases. $t$ test cases follow.\n\nEach test case is composed of a single line containing an integer $a$ denoting an atomic number.\n\n*Constraints*\n\n$1 <= t <= 10^5$\n\n$1 <= a <= 10^(15)$\n\nFor each test case, output a single line containing $n$, $l$ and $e$, NOT separated by spaces. For example, for $19$, output _4s1_. \n\n## Input\n\nThe first line of input contains $t$, the number of test cases. $t$ test cases follow.Each test case is composed of a single line containing an integer $a$ denoting an atomic number.*Constraints*$1 <= t <= 10^5$$1 <= a <= 10^(15)$\n\n## Output\n\nFor each test case, output a single line containing $n$, $l$ and $e$, NOT separated by spaces. For example, for $19$, output _4s1_. \n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ t_1, t_2, t_3 \\in \\mathbb{R} $ be the nominal temperatures of the cold, neutral, and hot dispensers.  \nLet $ m_i = \\frac{m_i^{(n)}}{m_i^{(d)}} \\in [0,1] $ for $ i \\in \\{1,2,3\\} $ be the probability that dispenser $ i $ malfunctions.  \nLet $ d_{i,j} = \\frac{d_{i,j}^{(n)}}{d_{i,j}^{(d)}} \\in [0,1] $ be the conditional probability that, given dispenser $ i $ malfunctions, it outputs temperature $ t_j $.  \nLet $ l, u \\in \\mathbb{R} $ be the lower and upper bounds of the acceptable temperature range.  \n\nLet $ v_1, v_2, v_3 \\in \\mathbb{R}_{\\geq 0} $ be the volumes (in mL) of water drawn from dispensers 1, 2, 3 respectively, such that $ v_1 + v_2 + v_3 = 1000 $.  \n\n**Given/Constraints**  \n1. $ v_1 + v_2 + v_3 = 1000 $, $ v_i \\geq 0 $ for all $ i $.  \n2. At most one dispenser malfunctions; the malfunction events are mutually exclusive.  \n3. For each dispenser $ i $, the conditional probabilities satisfy:  \n   $$\n   \\sum_{j=1}^3 d_{i,j} = 1 \\quad \\text{for all } i \\in \\{1,2,3\\}.\n   $$  \n4. The malfunction probabilities satisfy:  \n   $$\n   0 \\leq m_i \\leq 1 \\quad \\text{for all } i \\in \\{1,2,3\\}.\n   $$  \n\n**Objective**  \nMaximize the probability $ P $ that the final drink temperature $ T $ satisfies $ l \\leq T \\leq u $, over all choices of $ (v_1, v_2, v_3) $.  \n\nThe temperature $ T $ is a random variable determined by:  \n- With probability $ (1 - m_1)(1 - m_2)(1 - m_3) $: no malfunction, $ T = \\frac{v_1 t_1 + v_2 t_2 + v_3 t_3}{1000} $.  \n- With probability $ m_i \\cdot d_{i,j} $: dispenser $ i $ malfunctions and outputs $ t_j $, so:  \n  $$\n  T = \\frac{v_1 \\cdot (\\text{actual output of disp }1) + v_2 \\cdot (\\text{actual output of disp }2) + v_3 \\cdot (\\text{actual output of disp }3)}{1000}\n  $$  \n  where the output of dispenser $ i $ is $ t_j $, and others are nominal.  \n\nThus, the total probability is:  \n$$\nP = \\sum_{\\text{all scenarios}} \\Pr(\\text{scenario}) \\cdot \\mathbf{1}\\left[l \\leq \\frac{\\sum_{k=1}^3 v_k \\cdot T_k^{\\text{actual}}}{1000} \\leq u\\right]\n$$  \nwhere $ T_k^{\\text{actual}} $ is the actual temperature output by dispenser $ k $ under the scenario.  \n\n**Output**  \nThe maximum value of $ P $, expressed as a reduced fraction $ \\frac{x}{y} $ with $ y > 0 $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10253J","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}