結果

問題 No.800 四平方定理
ユーザー tikitaka1201tikitaka1201
提出日時 2020-09-16 20:23:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 352 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 303,040 KB
最終ジャッジ日時 2023-09-04 03:54:50
合計ジャッジ時間 27,443 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
86,836 KB
testcase_01 AC 141 ms
88,916 KB
testcase_02 AC 131 ms
84,856 KB
testcase_03 AC 132 ms
87,856 KB
testcase_04 AC 131 ms
84,640 KB
testcase_05 AC 132 ms
86,412 KB
testcase_06 AC 147 ms
92,592 KB
testcase_07 AC 131 ms
88,236 KB
testcase_08 AC 144 ms
92,588 KB
testcase_09 AC 140 ms
89,420 KB
testcase_10 AC 1,745 ms
261,212 KB
testcase_11 AC 1,971 ms
302,492 KB
testcase_12 AC 1,890 ms
301,524 KB
testcase_13 AC 1,737 ms
266,820 KB
testcase_14 AC 1,908 ms
302,524 KB
testcase_15 AC 1,952 ms
302,448 KB
testcase_16 AC 1,941 ms
302,764 KB
testcase_17 AC 1,888 ms
303,040 KB
testcase_18 AC 1,971 ms
302,804 KB
testcase_19 AC 1,991 ms
302,640 KB
testcase_20 AC 90 ms
71,820 KB
testcase_21 AC 89 ms
71,500 KB
testcase_22 AC 1,899 ms
302,720 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
def MI():
    return map(int, input().split())

n,d=MI()
from collections import defaultdict
xydic=defaultdict(int)
wzdic=defaultdict(int)
for i in range(1,n+1):
    for j in range(1,n+1):
        wzdic[i**2-j**2+d]+=1
        xydic[i**2+j**2]+=1

ans=0
for i in xydic.keys():
    ans+=wzdic[i]*xydic[i]
print(ans)
0