結果

問題 No.1318 ABCD quadruplets
ユーザー H3PO4H3PO4
提出日時 2022-10-09 08:41:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,008 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 83,568 KB
最終ジャッジ日時 2023-09-05 12:36:57
合計ジャッジ時間 15,004 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,232 KB
testcase_01 AC 71 ms
71,160 KB
testcase_02 AC 72 ms
71,384 KB
testcase_03 AC 75 ms
71,056 KB
testcase_04 AC 72 ms
71,060 KB
testcase_05 AC 71 ms
71,284 KB
testcase_06 AC 70 ms
71,368 KB
testcase_07 AC 72 ms
71,284 KB
testcase_08 AC 73 ms
71,192 KB
testcase_09 AC 71 ms
71,196 KB
testcase_10 AC 73 ms
71,060 KB
testcase_11 AC 73 ms
71,008 KB
testcase_12 AC 73 ms
71,036 KB
testcase_13 AC 155 ms
77,432 KB
testcase_14 AC 1,388 ms
83,568 KB
testcase_15 AC 110 ms
77,676 KB
testcase_16 TLE -
testcase_17 AC 132 ms
80,824 KB
testcase_18 AC 1,210 ms
82,824 KB
testcase_19 AC 467 ms
82,888 KB
testcase_20 AC 151 ms
77,588 KB
testcase_21 AC 293 ms
79,184 KB
testcase_22 AC 122 ms
82,312 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):
        for b in range(a, M + 1):
            for c in range(b, M + 1):
                for d in range(c, M + 1):
                    x = a ** 2 + a * b + a * c + a * d + b ** 2 + b * c + b * d + c ** 2 + c * d + d ** 2
                    if x > N:
                        break
                    if a == b == c == d:
                        res[x] += 1
                    elif a == b == c:
                        res[x] += 4
                    elif b == c == d:
                        res[x] += 4
                    elif a == b and c == d:
                        res[x] += 6
                    elif a == b:
                        res[x] += 12
                    elif b == c:
                        res[x] += 12
                    elif c == d:
                        res[x] += 12
                    else:
                        res[x] += 24
    return res


N, M = map(int, input().split())
print(*solve(N, M), sep="\n")
0