結果

問題 No.800 四平方定理
ユーザー i_takui_taku
提出日時 2023-09-29 10:22:39
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 314 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 377,780 KB
最終ジャッジ日時 2023-09-29 10:23:07
合計ジャッジ時間 26,859 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
80,808 KB
testcase_01 AC 136 ms
85,560 KB
testcase_02 AC 131 ms
82,700 KB
testcase_03 AC 138 ms
83,588 KB
testcase_04 AC 128 ms
81,956 KB
testcase_05 AC 130 ms
83,116 KB
testcase_06 AC 147 ms
88,056 KB
testcase_07 AC 133 ms
84,564 KB
testcase_08 AC 146 ms
88,248 KB
testcase_09 AC 139 ms
85,880 KB
testcase_10 AC 1,664 ms
223,016 KB
testcase_11 AC 1,767 ms
239,312 KB
testcase_12 AC 1,800 ms
239,544 KB
testcase_13 AC 1,653 ms
226,228 KB
testcase_14 AC 1,763 ms
239,564 KB
testcase_15 AC 1,837 ms
239,404 KB
testcase_16 AC 1,860 ms
239,592 KB
testcase_17 AC 1,853 ms
239,516 KB
testcase_18 AC 1,865 ms
239,428 KB
testcase_19 AC 1,848 ms
239,532 KB
testcase_20 AC 93 ms
71,508 KB
testcase_21 AC 97 ms
71,368 KB
testcase_22 AC 1,918 ms
239,548 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

N, D = map(int, input().split())
cp, cm = defaultdict(int), defaultdict(int)
for x in range(1, N + 1):
    for y in range(1, N + 1):
        cp[x**2 + y**2] += 1
        cm[x**2 - y**2] += 1
ans = 0
for key, value in cp.items():
    ans += value * cm.get(key - D, 0)
print(ans)
0