atcoder#ARC122E. [ARC122E] Increasing LCMs
[ARC122E] Increasing LCMs
Score : points
Problem Statement
We have a sequence of positive integers: . You are to rearrange these integers into another sequence , where must satisfy the following condition:
- Let us define , where the function returns the least common multiple of the given integers. Then, is strictly increasing. In other words, $y_1 holds.
Determine whether it is possible to form a sequence satisfying the condition, and show one such sequence if it is possible.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If it is possible to form a sequence satisfying the condition, print your answer in the following format:
Yes
If it is impossible, print No
.
3
3 4 6
Yes
3 6 4
For , we have:
Here, $y_1 holds.
3
2 3 6
No
No permutation of would satisfy the condition.
10
922513 346046618969 3247317977078471 4638516664311857 18332844097865861 81706734998806133 116282391418772039 134115264093375553 156087536381939527 255595307440611247
Yes
922513 346046618969 116282391418772039 81706734998806133 255595307440611247 156087536381939527 134115264093375553 18332844097865861 3247317977078471 4638516664311857