問題一覧 > 通常問題

No.942 Distributing Presents

レベル : / AI推定難易度 : 1650 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 64
作問者 : ei13337 / テスター : ei1333333
お気に入りにしたユーザー ProblemId : 3678 / 自分の提出
問題文最終更新日: 2019-12-04 22:28:45
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
Advent Calendar Contest 2019 (順位表) の他の問題:

Problem Statement

yuki, the king of the Yuki Kingdom, has prepared $N$ presents for the coming Christmas.

Each present has a value called its "worth", and the worth of the $i~(1 \leq i \leq N)$-th present is $i$.

There are currently $K$ children in the Yuki Kingdom.

yuki wants to distribute the prepared presents to the children of the kingdom so that all of the following conditions are satisfied.

  • Each child receives the same number of presents
  • The sum of the worth of the presents received is the same for each child

yuki has asked you, the chancellor of the kingdom, whether such a distribution exists and, if it does, how the presents should be distributed.

Constraints

  • $1 \leq N \leq 200000$
  • $1 \leq K \leq N$
  • $K$ is a divisor of $N$
  • All inputs are integers

Input

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

$N$ $K$

Output

If no distribution of presents satisfying the conditions exists, print No.

If one exists, print Yes, then a newline, and then print $K$ more lines.

Here, on the $i + 1$-th line of the output, print the numbers of the presents received by the $i$-th child, separated by spaces.

If there are multiple distributions satisfying the conditions, any of them will be accepted.

Sample

Sample 1
Input
4 2
Output
Yes
2 3
1 4

Sample 2
Input
6 2
Output
No

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。