結果

問題 No.800 四平方定理
ユーザー tikitaka1201tikitaka1201
提出日時 2020-09-16 20:31:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 332 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 257,612 KB
最終ジャッジ日時 2023-09-04 03:56:14
合計ジャッジ時間 30,415 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
80,900 KB
testcase_01 AC 156 ms
86,844 KB
testcase_02 AC 142 ms
83,476 KB
testcase_03 AC 142 ms
84,208 KB
testcase_04 AC 133 ms
82,372 KB
testcase_05 AC 140 ms
84,020 KB
testcase_06 AC 160 ms
88,304 KB
testcase_07 AC 142 ms
85,168 KB
testcase_08 AC 126 ms
88,456 KB
testcase_09 AC 153 ms
86,916 KB
testcase_10 AC 1,923 ms
257,424 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,929 ms
257,612 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 73 ms
71,216 KB
testcase_21 AC 74 ms
71,064 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 #

def MI():
    return map(int, input().split())

n,d=MI()

wz,xy=[],[]
for i in range(1,n+1):
    for j in range(1,n+1):
        wz.append(i**2-j**2+d)
        xy.append(i**2+j**2)
wz=sorted(wz)
from bisect import bisect_right, bisect_left
ans=0
for i in xy:
    l=bisect_left(wz, i)
    r=bisect_right(wz, i)
    ans+=r-l
print(ans)
0