結果

問題 No.1318 ABCD quadruplets
ユーザー H3PO4H3PO4
提出日時 2022-10-09 09:11:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,440 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 86,976 KB
実行使用メモリ 85,232 KB
最終ジャッジ日時 2023-09-05 13:01:15
合計ジャッジ時間 15,043 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,156 KB
testcase_01 AC 74 ms
71,160 KB
testcase_02 AC 74 ms
71,256 KB
testcase_03 AC 74 ms
71,172 KB
testcase_04 AC 75 ms
71,160 KB
testcase_05 AC 74 ms
71,460 KB
testcase_06 AC 75 ms
71,412 KB
testcase_07 AC 75 ms
71,252 KB
testcase_08 AC 76 ms
71,244 KB
testcase_09 AC 73 ms
71,088 KB
testcase_10 AC 75 ms
71,108 KB
testcase_11 AC 74 ms
71,252 KB
testcase_12 AC 75 ms
71,364 KB
testcase_13 AC 143 ms
78,224 KB
testcase_14 AC 576 ms
83,852 KB
testcase_15 AC 120 ms
77,232 KB
testcase_16 AC 782 ms
82,924 KB
testcase_17 AC 134 ms
80,984 KB
testcase_18 AC 520 ms
83,268 KB
testcase_19 AC 238 ms
83,932 KB
testcase_20 AC 138 ms
77,540 KB
testcase_21 AC 194 ms
78,204 KB
testcase_22 AC 130 ms
81,940 KB
testcase_23 AC 1,380 ms
84,692 KB
testcase_24 AC 1,208 ms
84,972 KB
testcase_25 AC 326 ms
84,972 KB
testcase_26 AC 205 ms
83,828 KB
testcase_27 AC 873 ms
85,232 KB
testcase_28 AC 363 ms
84,852 KB
testcase_29 AC 435 ms
84,748 KB
testcase_30 AC 1,440 ms
85,216 KB
testcase_31 AC 340 ms
85,084 KB
testcase_32 AC 1,421 ms
84,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())

res = [0] * (N + 1)
for a in range(M + 1):
    a_ = a ** 2
    for b in range(a, M + 1):
        b_ = b * (a + b)
        if a_ + b_ > N:
            break
        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

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