結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 tatyamtatyam
提出日時 2020-07-25 00:07:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,444 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 79,484 KB
最終ジャッジ日時 2023-09-08 06:20:52
合計ジャッジ時間 14,791 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,088 KB
testcase_01 AC 70 ms
71,240 KB
testcase_02 AC 70 ms
70,840 KB
testcase_03 AC 71 ms
71,268 KB
testcase_04 AC 71 ms
71,176 KB
testcase_05 AC 71 ms
70,856 KB
testcase_06 AC 70 ms
71,252 KB
testcase_07 AC 71 ms
71,276 KB
testcase_08 AC 70 ms
71,364 KB
testcase_09 AC 71 ms
71,020 KB
testcase_10 AC 71 ms
71,088 KB
testcase_11 AC 70 ms
70,856 KB
testcase_12 AC 69 ms
71,176 KB
testcase_13 AC 144 ms
78,052 KB
testcase_14 AC 515 ms
78,496 KB
testcase_15 AC 120 ms
77,664 KB
testcase_16 AC 784 ms
78,468 KB
testcase_17 AC 131 ms
78,308 KB
testcase_18 AC 482 ms
78,260 KB
testcase_19 AC 247 ms
78,676 KB
testcase_20 AC 141 ms
77,508 KB
testcase_21 AC 188 ms
77,744 KB
testcase_22 AC 128 ms
79,032 KB
testcase_23 AC 1,422 ms
79,280 KB
testcase_24 AC 1,231 ms
79,484 KB
testcase_25 AC 336 ms
78,984 KB
testcase_26 AC 202 ms
78,980 KB
testcase_27 AC 904 ms
78,832 KB
testcase_28 AC 372 ms
78,764 KB
testcase_29 AC 452 ms
78,716 KB
testcase_30 AC 1,434 ms
78,996 KB
testcase_31 AC 349 ms
79,108 KB
testcase_32 AC 1,444 ms
78,640 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):
        for c in range(b,m + 1):
            for d in range(c,m + 1):
                s = a * a + (a + b) * b + (a + b + c) * c + (a + b + c + d) * d
                if s > n:
                    break
                if a == b == c == d:
                    ans[s] += 1
                elif a == b == c or b == c == d:
                    ans[s] += 4
                elif a == b and c == d:
                    ans[s] += 6
                elif a == b or b == c or c == d:
                    ans[s] += 12
                else:
                    ans[s] += 24

for i in ans:
    print(i)
0