結果

問題 No.1318 ABCD quadruplets
ユーザー H3PO4H3PO4
提出日時 2022-10-09 08:46:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 871 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 82,620 KB
最終ジャッジ日時 2023-09-05 12:42:12
合計ジャッジ時間 11,618 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,904 KB
testcase_01 AC 74 ms
71,216 KB
testcase_02 AC 75 ms
71,172 KB
testcase_03 AC 77 ms
71,188 KB
testcase_04 AC 76 ms
71,264 KB
testcase_05 AC 73 ms
71,324 KB
testcase_06 AC 75 ms
71,188 KB
testcase_07 AC 75 ms
71,192 KB
testcase_08 AC 75 ms
71,368 KB
testcase_09 AC 73 ms
71,092 KB
testcase_10 AC 75 ms
71,016 KB
testcase_11 AC 75 ms
71,372 KB
testcase_12 AC 72 ms
71,184 KB
testcase_13 AC 144 ms
77,444 KB
testcase_14 AC 1,215 ms
78,580 KB
testcase_15 AC 111 ms
77,556 KB
testcase_16 TLE -
testcase_17 AC 129 ms
78,252 KB
testcase_18 AC 1,067 ms
78,796 KB
testcase_19 AC 416 ms
78,572 KB
testcase_20 AC 140 ms
77,716 KB
testcase_21 AC 264 ms
77,864 KB
testcase_22 AC 116 ms
79,044 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

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