問題一覧 > 通常問題

No.1318 ABCD quadruplets

レベル : / AI推定難易度 : 1400 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 67
作問者 : tatyam / テスター : SSlime
お気に入りにしたユーザー ProblemId : 4701 / 自分の提出
問題文最終更新日: 2020-12-15 00:39:32
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 2020 (順位表) の他の問題:

Notice

It is possible to get AC with PyPy3. (The writer took about 1.3s with effort.)

Problem Statement

Let $f(n,m)$ be the number of tuples of $4$ integers $(a,b,c,d)$ that satisfy both of the following $2$ conditions.

  • $0 ≤ a, b, c, d ≤ m$
  • $a^2 + ab + ac + ad + b^2 + bc + bd + c^2 + cd + d^2 = n$
Given integers $N, M$, find each of $f(0,M),f(1,M),f(2,M),\dots,f(N,M)$.

Input

$N\ M$

  • All input values are integers
  • $1 ≤ N ≤ 160000$
  • $1 ≤ M ≤ \sqrt{N}$

Output

Print $f(0,M),f(1,M),f(2,M),\dots,f(N,M)$ separated by newlines. Print a newline at the end.

Sample

Sample 1
Input
20 4
Output
1
4
0
6
4
0
4
12
0
4
1
12
6
12
0
0
8
12
12
12
0

Sample 2
Input
20 3
Output
1
4
0
6
4
0
4
12
0
4
1
12
6
12
0
0
4
12
12
12
0

Sample 3
Input
20 2
Output
1
4
0
6
4
0
4
12
0
0
1
12
6
0
0
0
4
12
0
0
0

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