結果

問題 No.1318 ABCD quadruplets
ユーザー H3PO4
提出日時 2022-10-09 08:46:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 871 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 84,428 KB
最終ジャッジ日時 2024-06-23 08:21:42
合計ジャッジ時間 10,256 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 TLE * 2 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

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