結果

問題 No.1318 ABCD quadruplets
ユーザー SSlimeSSlime
提出日時 2020-07-24 23:42:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,493 ms / 2,000 ms
コード長 906 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 86,404 KB
実行使用メモリ 81,172 KB
最終ジャッジ日時 2023-09-08 05:43:18
合計ジャッジ時間 15,894 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,044 KB
testcase_01 AC 74 ms
71,104 KB
testcase_02 AC 72 ms
71,048 KB
testcase_03 AC 74 ms
71,040 KB
testcase_04 AC 74 ms
70,956 KB
testcase_05 AC 75 ms
70,932 KB
testcase_06 AC 73 ms
70,940 KB
testcase_07 AC 73 ms
70,928 KB
testcase_08 AC 75 ms
70,892 KB
testcase_09 AC 73 ms
71,068 KB
testcase_10 AC 77 ms
70,908 KB
testcase_11 AC 73 ms
71,204 KB
testcase_12 AC 74 ms
70,976 KB
testcase_13 AC 168 ms
77,360 KB
testcase_14 AC 630 ms
80,020 KB
testcase_15 AC 126 ms
77,104 KB
testcase_16 AC 782 ms
79,560 KB
testcase_17 AC 129 ms
78,216 KB
testcase_18 AC 555 ms
79,748 KB
testcase_19 AC 267 ms
79,976 KB
testcase_20 AC 143 ms
77,236 KB
testcase_21 AC 206 ms
77,696 KB
testcase_22 AC 121 ms
78,716 KB
testcase_23 AC 1,493 ms
80,644 KB
testcase_24 AC 1,366 ms
80,620 KB
testcase_25 AC 353 ms
80,160 KB
testcase_26 AC 217 ms
79,804 KB
testcase_27 AC 1,032 ms
81,172 KB
testcase_28 AC 401 ms
80,196 KB
testcase_29 AC 482 ms
80,564 KB
testcase_30 AC 1,464 ms
80,676 KB
testcase_31 AC 375 ms
80,152 KB
testcase_32 AC 1,468 ms
80,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())

ans = [0]*(n+1)
for a in range(m + 1):
    for b in range(a,m + 1):
        if a * a + b * b + (a + b)*(a+b)> 2*n:
            break
        for c in range(b,m + 1):
            if a * a + b * b + c * c + (a + b + c) * (a + b + c) > 2*n:
                break
            for d in range(c,m + 1):
                s = a*a + b*b + c*c + d*d + (a+b+c+d)**2
                if s > 2 * n:
                    break
                if s % 2 == 1: continue
                if a == b == c == d:
                    ans[s // 2] += 1
                elif a == b == c or b == c == d:
                    ans[s // 2] += 4
                elif a == b and c == d:
                    ans[s // 2] += 6
                elif a == b or b == c or c == d:
                    ans[s // 2] += 12
                else:
                    ans[s // 2] += 24
print("\n".join(str(i) for i in ans))
0