結果

問題 No.800 四平方定理
ユーザー kurimupykurimupy
提出日時 2020-06-16 00:06:41
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 391 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 363,236 KB
最終ジャッジ日時 2023-09-16 10:43:51
合計ジャッジ時間 32,336 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
81,356 KB
testcase_01 AC 130 ms
85,660 KB
testcase_02 AC 125 ms
83,176 KB
testcase_03 AC 120 ms
83,856 KB
testcase_04 AC 119 ms
82,144 KB
testcase_05 AC 121 ms
83,496 KB
testcase_06 AC 129 ms
88,588 KB
testcase_07 AC 122 ms
84,780 KB
testcase_08 AC 127 ms
88,308 KB
testcase_09 AC 127 ms
85,880 KB
testcase_10 AC 951 ms
245,100 KB
testcase_11 AC 1,046 ms
249,572 KB
testcase_12 AC 1,072 ms
243,436 KB
testcase_13 AC 1,015 ms
249,260 KB
testcase_14 AC 1,085 ms
249,544 KB
testcase_15 AC 1,080 ms
247,156 KB
testcase_16 AC 1,150 ms
249,696 KB
testcase_17 AC 1,084 ms
251,344 KB
testcase_18 AC 1,077 ms
249,436 KB
testcase_19 AC 1,084 ms
249,844 KB
testcase_20 AC 88 ms
71,424 KB
testcase_21 AC 87 ms
71,876 KB
testcase_22 AC 1,109 ms
251,468 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 88 ms
71,428 KB
testcase_27 AC 88 ms
71,584 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,926 ms
341,492 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#4平方定理
N,D=map(int,input().split())
from collections import defaultdict
d=defaultdict(int)
e=defaultdict(int)
for i in range(1,N+1):
    for j in range(1,N+1):
        d[i**2+j**2]+=1
for i in range(1,N+1):
    for j in range(1,N+1):
        e[i**2-j**2+D]+=1
ans=0
bound=max(e.keys())
for key in d.keys():
    if key<=bound and key in e.keys():
        ans+=d[key]*e[key]
print(ans)
0