結果

問題 No.1318 ABCD quadruplets
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-27 18:34:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,565 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 84,404 KB
最終ジャッジ日時 2024-04-09 18:17:29
合計ジャッジ時間 14,232 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,432 KB
testcase_01 AC 38 ms
52,280 KB
testcase_02 AC 37 ms
52,680 KB
testcase_03 AC 38 ms
53,744 KB
testcase_04 AC 38 ms
52,824 KB
testcase_05 AC 37 ms
52,544 KB
testcase_06 AC 38 ms
52,192 KB
testcase_07 AC 38 ms
53,896 KB
testcase_08 AC 37 ms
53,000 KB
testcase_09 AC 37 ms
53,816 KB
testcase_10 AC 39 ms
54,420 KB
testcase_11 AC 37 ms
52,068 KB
testcase_12 AC 38 ms
53,880 KB
testcase_13 AC 112 ms
77,048 KB
testcase_14 AC 551 ms
82,704 KB
testcase_15 AC 90 ms
76,664 KB
testcase_16 AC 761 ms
81,812 KB
testcase_17 AC 104 ms
79,728 KB
testcase_18 AC 496 ms
81,648 KB
testcase_19 AC 231 ms
83,000 KB
testcase_20 AC 109 ms
76,500 KB
testcase_21 AC 162 ms
77,224 KB
testcase_22 AC 97 ms
81,468 KB
testcase_23 AC 1,479 ms
84,040 KB
testcase_24 AC 1,291 ms
83,980 KB
testcase_25 AC 307 ms
83,784 KB
testcase_26 AC 190 ms
82,900 KB
testcase_27 AC 937 ms
84,196 KB
testcase_28 AC 348 ms
84,312 KB
testcase_29 AC 423 ms
84,176 KB
testcase_30 AC 1,549 ms
84,320 KB
testcase_31 AC 324 ms
83,840 KB
testcase_32 AC 1,565 ms
84,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt = [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+b+c+d)**2 + a*a + b*b + c*c + d*d) // 2
                if x > N:
                    break
                if a == b == c == d:
                    cnt[x] += 1
                elif a == b == c or b == c == d:
                    cnt[x] += 4
                elif a == b and c == d:
                    cnt[x] += 6
                elif a == b or b == c or c == d:
                    cnt[x] += 12
                else:
                    cnt[x] += 24

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