結果

問題 No.1318 ABCD quadruplets
ユーザー H3PO4H3PO4
提出日時 2022-10-09 08:45:45
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 866 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 86,848 KB
実行使用メモリ 83,920 KB
最終ジャッジ日時 2023-09-05 12:40:44
合計ジャッジ時間 12,038 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
75,700 KB
testcase_01 AC 75 ms
71,032 KB
testcase_02 AC 75 ms
71,188 KB
testcase_03 AC 75 ms
71,160 KB
testcase_04 AC 75 ms
71,092 KB
testcase_05 AC 74 ms
71,288 KB
testcase_06 AC 74 ms
71,168 KB
testcase_07 AC 72 ms
71,032 KB
testcase_08 AC 76 ms
71,384 KB
testcase_09 AC 77 ms
70,968 KB
testcase_10 AC 76 ms
71,232 KB
testcase_11 AC 73 ms
71,228 KB
testcase_12 AC 73 ms
71,092 KB
testcase_13 AC 144 ms
77,304 KB
testcase_14 AC 1,223 ms
83,620 KB
testcase_15 AC 109 ms
77,392 KB
testcase_16 TLE -
testcase_17 AC 128 ms
80,864 KB
testcase_18 AC 1,085 ms
82,952 KB
testcase_19 AC 422 ms
83,920 KB
testcase_20 AC 138 ms
77,812 KB
testcase_21 AC 265 ms
79,100 KB
testcase_22 AC 115 ms
82,300 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())
print(*solve(N, M), sep="\n")
0