結果

問題 No.800 四平方定理
ユーザー lloyzlloyz
提出日時 2022-11-03 13:20:59
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 345 bytes
コンパイル時間 1,154 ms
コンパイル使用メモリ 86,412 KB
実行使用メモリ 255,148 KB
最終ジャッジ日時 2023-09-24 22:48:37
合計ジャッジ時間 33,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
78,552 KB
testcase_01 AC 165 ms
81,460 KB
testcase_02 AC 146 ms
80,000 KB
testcase_03 AC 149 ms
80,316 KB
testcase_04 AC 142 ms
79,600 KB
testcase_05 AC 152 ms
79,892 KB
testcase_06 AC 168 ms
82,108 KB
testcase_07 AC 151 ms
80,504 KB
testcase_08 AC 135 ms
82,200 KB
testcase_09 AC 163 ms
81,272 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 77 ms
71,436 KB
testcase_21 AC 77 ms
71,360 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 #

from bisect import bisect_left, bisect_right

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

L = []
for w in range(1, n + 1):
    for z in range(1, n + 1):
        L.append(w**2 - z**2)
L.sort()
ans = 0
for x in range(1, n + 1):
    for y in range(1, n + 1):
        res = x**2 + y**2 - d
        ans += bisect_right(L, res) - bisect_left(L, res)
print(ans)
0