結果

問題 No.1318 ABCD quadruplets
コンテスト
ユーザー H3PO4
提出日時 2022-10-09 08:46:38
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 871 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 136 ms
コンパイル使用メモリ 85,304 KB
実行使用メモリ 83,084 KB
最終ジャッジ日時 2026-03-08 01:39:14
合計ジャッジ時間 15,882 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve(N, M):
    res = [0] * (N + 1)
    for a in range(M + 1):
        a_ = a ** 2
        for b in range(a, M + 1):
            b_ = b * (a + b)
            for c in range(b, M + 1):
                c_ = c * (a + b + c)
                for d in range(c, M + 1):
                    x = a_ + b_ + c_ + d * (a + b + c + d)
                    if x > N:
                        break
                    if a == b == c == d:
                        res[x] += 1
                    elif a == b == c or b == c == d:
                        res[x] += 4
                    elif a == b and c == d:
                        res[x] += 6
                    elif a == b or b == c or c == d:
                        res[x] += 12
                    else:
                        res[x] += 24
    return res


N, M = map(int, input().split())
for x in solve(N, M):
    print(x)
0