atcoder#ARC159C. [ARC159C] Permutation Addition
[ARC159C] Permutation Addition
Score : points
Problem Statement
You are given a sequence of positive integers: .
Determine whether it is possible to make all elements of equal by repeating the following operation between and times, inclusive. If it is possible, show one way to do so.
- Choose a permutation of , and replace with .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
If it is impossible to make all elements of equal, print No
.
If it is possible, print one way to do so in the following format, where is the number of operations, and is the permutation chosen in the -th operation:
Yes
If multiple solutions exist, you may print any of them.
2
15 9
Yes
8
1 2
1 2
1 2
1 2
2 1
1 2
1 2
1 2
This sequence of operations makes , where all elements are equal.
5
1 2 3 10 10
No
4
1 1 1 1
Yes
0
All elements of are equal from the beginning.