結果

問題 No.800 四平方定理
ユーザー OKCH3COOHOKCH3COOH
提出日時 2019-11-13 21:43:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 358 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 154,164 KB
最終ジャッジ日時 2023-10-21 19:52:26
合計ジャッジ時間 28,835 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
154,164 KB
testcase_01 AC 90 ms
12,280 KB
testcase_02 AC 75 ms
11,488 KB
testcase_03 AC 79 ms
11,752 KB
testcase_04 AC 72 ms
11,488 KB
testcase_05 AC 77 ms
11,752 KB
testcase_06 AC 99 ms
12,808 KB
testcase_07 AC 99 ms
12,808 KB
testcase_08 AC 115 ms
14,852 KB
testcase_09 AC 88 ms
12,280 KB
testcase_10 AC 1,921 ms
75,448 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,820 ms
74,696 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,981 ms
80,260 KB
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 29 ms
10,072 KB
testcase_21 AC 29 ms
10,072 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())
L = [i * i for i in range(1, N + 1)]

YZ = [0] * (2 * (N**2) + 1)
for i in L:
    for j in L:
        YZ[i + j] += 1

XW = [0] * (2 * (N**2) + 1 + D)
for w in L:
    for x in L:
        if D + w - x < 0:
            break
        XW[D + w - x] += 1

ans = 0
for i in range(2 * (N**2) + 1):
    ans += YZ[i] * XW[i]
print(ans)
0