AtCoder Regular Contest 159
C
Permutation Addition
AtCoder
⌀ 2304
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given a sequence of positive integers: $A=(a_1,\ldots,a_N)$.

翻译中…

Determine whether it is possible to make all elements of $A$ equal by repeating the following operation between $0$ and $10^4$ times, inclusive. If it is possible, show one way to do so.

翻译中…
  • Choose a permutation $(p_1,\ldots,p_N)$ of $(1,\ldots,N)$, and replace $A$ with $(a_1+p_1,\ldots,a_N+p_N)$.
翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 50$
  • $1 \leq a_i \leq 50$
  • All values in the input are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
a_1 \ldots a_N

翻译中…

Output

翻译中…

If it is impossible to make all elements of $A$ equal, print No. If it is possible, print one way to do so in the following format, where $M$ is the number of operations, and $(p_{i,1},\ldots,p_{i,N})$ is the permutation chosen in the $i$-th operation:

翻译中…

Yes
M
p_{1,1} \ldots p_{1,N}
\vdots
p_{M,1} \ldots p_{M,N}

翻译中…

If multiple solutions exist, you may print any of them.

翻译中…

样例

Input #1
2
15 9
Output #1
Yes
8
1 2
1 2
1 2
1 2
2 1
1 2
1 2
1 2
This sequence of $8$ operations makes $A = (24,24)$, where all elements are equal.
Input #2
5
1 2 3 10 10
Output #2
No
Input #3
4
1 1 1 1
Output #3
Yes
0
All elements of $A$ are equal from the beginning.
题目信息
题号
arc159_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。