P27278 [AtCoder] Constructing a Sequence Problem
省选
题目描述

Problem Description

Construct an integer sequence $ a_1, a_2, ..., a_N $ of $ N $ elements that satisfies the following conditions:

  • $0 \leq a_i \leq 10^{12}$
  • For $ M $ integers $ c_1, c_2, ..., c_M $, $ a_{c_i} = 0 $
  • When $b_i = \sum_{j | i} a_j$, for each $ i $ satisfying $1 \leq i \leq N-1$, $ b_i $

Here, $ j | i $ means that $ j $ divides $ i $.

Input Format

The input is given from the standard input in the following format:

$ N $ $ M $ $ c_1 $ $ c_2 $ $ ... $ $ c_M $

Output Format

If it is impossible to construct a sequence that satisfies the conditions in the problem statement, output No.
If it is possible, output Yes followed by the elements of the sequence that satisfies the conditions.

Sample Input and Output

Sample Input #1

3 1
1

Sample Output #1

Yes
0 1 2

Sample Input #2

3 3
1 2 3

Sample Output #2

No

Notes/Hints

Constraints

  • All inputs are integers.
  • $1 \leq N \leq 3 \times 10^5$
  • $1 \leq M \leq N$
  • $1 \leq c_i \leq N$
  • The $ M $ integers $ c_1, c_2, ..., c_M $ are all distinct.

Sample Explanation 1

Each element of this sequence is a non-negative integer, satisfying the first condition. Also, since $ a_1 = 0 $, it satisfies the second condition. Furthermore, $ b_1 = a_1 = 0 $, $ b_2 = a_1 + a_2 = 1 $, and $ b_3 = a_1 + a_3 = 2 $, satisfying the third condition as well.

Sample Explanation 2

In this case, $ a_1 = a_2 = a_3 = 0 $ is required, but this always results in $ b_1 = b_2 = b_3 = 0 $, making it impossible to satisfy the third condition.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 1
样例输出
Yes 0 1 2