結果

問題 No.800 四平方定理
ユーザー mkawa2mkawa2
提出日時 2021-02-13 17:02:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 306 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 87,336 KB
実行使用メモリ 400,716 KB
最終ジャッジ日時 2023-09-28 01:32:46
合計ジャッジ時間 22,965 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
82,440 KB
testcase_01 AC 122 ms
89,228 KB
testcase_02 AC 114 ms
84,544 KB
testcase_03 AC 113 ms
87,604 KB
testcase_04 AC 111 ms
84,248 KB
testcase_05 AC 117 ms
86,612 KB
testcase_06 AC 125 ms
92,548 KB
testcase_07 AC 117 ms
87,968 KB
testcase_08 AC 121 ms
92,592 KB
testcase_09 AC 126 ms
89,628 KB
testcase_10 AC 1,405 ms
260,868 KB
testcase_11 AC 1,785 ms
303,840 KB
testcase_12 AC 1,466 ms
302,872 KB
testcase_13 AC 1,364 ms
278,196 KB
testcase_14 AC 1,491 ms
303,872 KB
testcase_15 AC 1,548 ms
303,612 KB
testcase_16 AC 1,478 ms
304,368 KB
testcase_17 AC 1,510 ms
304,656 KB
testcase_18 AC 1,457 ms
303,924 KB
testcase_19 AC 1,527 ms
304,184 KB
testcase_20 AC 81 ms
71,392 KB
testcase_21 AC 82 ms
71,532 KB
testcase_22 AC 1,525 ms
304,572 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

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