結果

問題 No.800 四平方定理
ユーザー mkawa2
提出日時 2021-02-13 17:02:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 306 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 263,196 KB
最終ジャッジ日時 2024-07-20 20:09:45
合計ジャッジ時間 8,023 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def MI(): return map(int, sys.stdin.buffer.readline().split())

from collections import defaultdict

n,d=MI()
l,r=defaultdict(int),defaultdict(int)

for x in range(1,n+1):
    for y in range(1,n+1):
        l[x*x+y*y]+=1
        r[x*x-y*y+d]+=1

ans=sum(v*r[k] for k,v in l.items())
print(ans)
0