結果

問題 No.1318 ABCD quadruplets
ユーザー SSlimeSSlime
提出日時 2020-07-24 23:37:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 908 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 12,248 KB
最終ジャッジ日時 2023-09-08 05:38:29
合計ジャッジ時間 6,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 16 ms
7,828 KB
testcase_06 AC 16 ms
7,824 KB
testcase_07 AC 17 ms
7,856 KB
testcase_08 AC 16 ms
7,744 KB
testcase_09 WA -
testcase_10 AC 17 ms
7,812 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

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