#P16275. [蓝桥杯 2026 省 C] 纯粹魔药
[蓝桥杯 2026 省 C] 纯粹魔药
Problem Description
You are an apprentice alchemist. To pass the graduation assessment, you need to brew a bottle of “Pure Magic Potion”.
In front of you there are kinds of magic materials. The current “magic concentration” of each material is a positive integer, denoted in order as .
You can perform a magic operation called “refining” on these materials. Each time, you may choose any one material and cast the refining spell on it:
- If the material’s current magic concentration is , then after casting, its magic concentration becomes the number of positive divisors of , denoted as .
For example: if the concentration is , since has in total four divisors, after refining the concentration becomes .
You may refine any material any number of times (or not refine it at all).
According to the rules of alchemy, the Pure Magic Potion can be brewed successfully only when the product of the magic concentrations of these materials is exactly a prime number (that is, an integer greater than that is divisible only by and itself, such as , etc.).
Now, determine whether it is possible, through some number of operations, to successfully brew the Pure Magic Potion.
Input Format
The first line contains an integer , the number of testdata sets.
For each testdata set:
- The first line contains an integer , the number of magic materials.
- The second line contains integers , representing the initial magic concentration of each material.
Output Format
For each testdata set, if you can make the product of the final magic concentrations of all materials become a prime number, output YES; otherwise output NO.
2
3
1 6 1
4
1 1 1 1
YES
NO
Hint
Constraints
For of the testdata, , , .
For all testdata, , , , and it is guaranteed that for all testdata, the sum of does not exceed .
Translated by ChatGPT 5