結果

問題 No.1318 ABCD quadruplets
ユーザー 👑 tatyamtatyam
提出日時 2020-07-24 23:50:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,390 ms / 2,000 ms
コード長 834 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 86,708 KB
実行使用メモリ 80,808 KB
最終ジャッジ日時 2023-09-08 05:53:47
合計ジャッジ時間 14,240 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,108 KB
testcase_01 AC 70 ms
71,252 KB
testcase_02 AC 75 ms
70,972 KB
testcase_03 AC 71 ms
71,136 KB
testcase_04 AC 70 ms
71,096 KB
testcase_05 AC 73 ms
71,056 KB
testcase_06 AC 72 ms
71,044 KB
testcase_07 AC 72 ms
71,276 KB
testcase_08 AC 75 ms
71,140 KB
testcase_09 AC 76 ms
71,084 KB
testcase_10 AC 73 ms
71,052 KB
testcase_11 AC 72 ms
70,912 KB
testcase_12 AC 74 ms
71,164 KB
testcase_13 AC 137 ms
77,372 KB
testcase_14 AC 536 ms
79,912 KB
testcase_15 AC 117 ms
77,084 KB
testcase_16 AC 725 ms
79,364 KB
testcase_17 AC 126 ms
78,196 KB
testcase_18 AC 489 ms
79,580 KB
testcase_19 AC 240 ms
79,884 KB
testcase_20 AC 137 ms
77,164 KB
testcase_21 AC 189 ms
77,944 KB
testcase_22 AC 118 ms
79,120 KB
testcase_23 AC 1,334 ms
80,688 KB
testcase_24 AC 1,214 ms
80,772 KB
testcase_25 AC 326 ms
80,212 KB
testcase_26 AC 200 ms
79,260 KB
testcase_27 AC 955 ms
80,708 KB
testcase_28 AC 364 ms
80,408 KB
testcase_29 AC 443 ms
80,384 KB
testcase_30 AC 1,390 ms
80,808 KB
testcase_31 AC 340 ms
80,316 KB
testcase_32 AC 1,388 ms
80,656 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 + (a + b) * b > n:
            break
        for c in range(b,m + 1):
            if a * a + (a + b) * b + (a + b + c) * c > n:
                break
            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
print("\n".join(str(i) for i in ans))
0