結果

問題 No.1318 ABCD quadruplets
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-25 22:41:35
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 711 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 265,800 KB
最終ジャッジ日時 2023-10-23 22:49:17
合計ジャッジ時間 8,357 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
265,800 KB
testcase_01 AC 43 ms
55,456 KB
testcase_02 AC 44 ms
55,456 KB
testcase_03 AC 43 ms
55,456 KB
testcase_04 AC 43 ms
55,456 KB
testcase_05 AC 43 ms
55,456 KB
testcase_06 AC 44 ms
55,456 KB
testcase_07 AC 42 ms
55,456 KB
testcase_08 AC 43 ms
55,456 KB
testcase_09 AC 44 ms
55,456 KB
testcase_10 AC 45 ms
55,456 KB
testcase_11 AC 44 ms
55,456 KB
testcase_12 AC 43 ms
55,456 KB
testcase_13 AC 248 ms
81,032 KB
testcase_14 AC 1,765 ms
131,040 KB
testcase_15 AC 97 ms
77,396 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N, M = map(int, input().split())

cnt = [defaultdict(int) for _ in range(2 * M + 1)]
for a in range(M + 1):
    for b in range(M + 1):
        x = a * a + a * b + b * b
        if x <= N:
            cnt[a + b][x] += 1

cntcnt = [defaultdict(int) for _ in range(3 * M + 1)]
for ab, dd in enumerate(cnt):
    for c in range(M + 1):
        x = ab*c + c*c
        for k, v in dd.items():
            if x + k <= N:
                cntcnt[ab + c][x + k] += v

ans = [0] * (N + 1)
for abc, dd in enumerate(cntcnt):
    for d in range(M + 1):
        x = abc*d + d*d
        for k, v in dd.items():
            if x + k <= N:
                ans[x + k] += v

print(*ans, sep="\n")
0