結果

問題 No.1318 ABCD quadruplets
ユーザー SSlimeSSlime
提出日時 2020-07-24 23:35:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 80,284 KB
最終ジャッジ日時 2023-09-08 05:36:44
合計ジャッジ時間 24,767 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,448 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 68 ms
71,176 KB
testcase_06 AC 70 ms
71,272 KB
testcase_07 AC 75 ms
71,192 KB
testcase_08 AC 69 ms
71,304 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = [0]*(n+1)
for a in range(n + 1):
    for b in range(a,n + 1):
        if a * a + b * b + (a + b)*(a+b)> 2*n:
            break
        for c in range(b,n + 1):
            if a * a + b * b + c * c + (a + b + c) * (a + b + c) > 2*n:
                break
            for d in range(c,n + 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