{"problem":{"name":"K. Profact","description":{"content":"Alice is bored out of her mind by her math classes. She craves for something much more exciting. That is why she invented a new type of numbers, the #cf_span(class=[tex-font-style-underline], body=[pr","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10079K"},"statements":[{"statement_type":"Markdown","content":"Alice is bored out of her mind by her math classes. She craves for something much more exciting. That is why she invented a new type of numbers, the #cf_span(class=[tex-font-style-underline], body=[profacts]). Alice calls a positive integer number a profact if it can be expressed as a product of one or several factorials.\n\nJust today Alice received n bills. She wonders whether the costs on the bills are profact numbers. But the numbers are too large, help Alice check this!\n\nThe first line contains a single integer n, the number of bills (1 ≤ n ≤ 105). Each of the next n lines contains a single integer ai, the cost on the i-th bill (1 ≤ ai ≤ 1018).\n\nOutput n lines, on the i-th line output the answer for the number ai. If the number ai is a profact, output \"_YES_\", otherwise output \"_NO_\".\n\nA #cf_span(class=[tex-font-style-underline], body=[factorial]) is any number that can be expressed as 1·2·3·...·k, for some positive integer k, and is denoted by k!.\n\n## Input\n\nThe first line contains a single integer n, the number of bills (1 ≤ n ≤ 105). Each of the next n lines contains a single integer ai, the cost on the i-th bill (1 ≤ ai ≤ 1018).\n\n## Output\n\nOutput n lines, on the i-th line output the answer for the number ai. If the number ai is a profact, output \"_YES_\", otherwise output \"_NO_\".\n\n[samples]\n\n## Note\n\nA #cf_span(class=[tex-font-style-underline], body=[factorial]) is any number that can be expressed as 1·2·3·...·k, for some positive integer k, and is denoted by k!.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ \\mathcal{F} = \\{ k! \\mid k \\in \\mathbb{Z}^+ \\} $ be the set of factorials.  \nA *profact* is a positive integer that can be expressed as a product of one or more elements from $ \\mathcal{F} $, i.e.,  \n$$\n\\mathcal{P} = \\left\\{ \\prod_{i=1}^m f_i \\mid m \\geq 1, \\, f_i \\in \\mathcal{F} \\right\\}.\n$$\n\n**Given**  \nLet $ n \\in \\mathbb{Z} $, $ 1 \\leq n \\leq 10^5 $, be the number of bills.  \nLet $ A = (a_1, a_2, \\dots, a_n) $, where each $ a_i \\in \\mathbb{Z} $, $ 1 \\leq a_i \\leq 10^{18} $, be the sequence of bill costs.\n\n**Objective**  \nFor each $ a_i \\in A $, determine whether $ a_i \\in \\mathcal{P} $.  \nOutput \"YES\" if $ a_i $ is a profact, otherwise output \"NO\".","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10079K","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}