結果

問題 No.800 四平方定理
ユーザー lumeffluxlumefflux
提出日時 2019-03-17 22:46:38
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 444 bytes
コンパイル時間 597 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 392,648 KB
最終ジャッジ日時 2023-09-22 08:54:19
合計ジャッジ時間 7,247 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
79,780 KB
testcase_01 AC 153 ms
92,504 KB
testcase_02 AC 124 ms
81,020 KB
testcase_03 AC 125 ms
81,612 KB
testcase_04 AC 121 ms
80,368 KB
testcase_05 AC 140 ms
88,548 KB
testcase_06 AC 165 ms
95,676 KB
testcase_07 AC 145 ms
91,040 KB
testcase_08 AC 157 ms
95,792 KB
testcase_09 AC 161 ms
93,308 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
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 #

from collections import defaultdict
N, D = map(int, input().split())
r1 = []
r2 = []
d1 = defaultdict(list)
d2 = defaultdict(list)
ans = 0
for x in range(1, N + 1):
    for y in range(1, N + 1):
        s = x**2 + y**2
        d1[str(s)].append([x, y])
for z in range(1, N + 1):
    for w in range(1, N + 1):
        if w**2 - z**2 + D > 1:
            s = d1.get(str(w**2 - z**2 + D))
            if s:
                ans += len(s)
print(ans)
0