No.1318 ABCD quadruplets
問題文最終更新日: 2020-12-15 00:39:32
English (AI translation)
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$
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もしくは右上の雲マークをクリックしてアカウントを作成してください。
tatyam