結果

問題 No.800 四平方定理
ユーザー ntudantuda
提出日時 2024-02-25 16:48:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 311 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 348,272 KB
最終ジャッジ日時 2024-02-25 16:50:12
合計ジャッジ時間 20,892 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
80,736 KB
testcase_01 AC 76 ms
78,232 KB
testcase_02 AC 70 ms
75,692 KB
testcase_03 AC 70 ms
76,596 KB
testcase_04 AC 67 ms
74,892 KB
testcase_05 AC 72 ms
76,244 KB
testcase_06 AC 90 ms
80,976 KB
testcase_07 AC 70 ms
75,660 KB
testcase_08 AC 79 ms
80,976 KB
testcase_09 AC 76 ms
78,672 KB
testcase_10 AC 1,204 ms
213,448 KB
testcase_11 AC 1,364 ms
235,220 KB
testcase_12 AC 1,380 ms
235,252 KB
testcase_13 AC 1,269 ms
224,308 KB
testcase_14 AC 1,360 ms
235,216 KB
testcase_15 AC 1,372 ms
235,108 KB
testcase_16 AC 1,376 ms
235,192 KB
testcase_17 AC 1,428 ms
235,200 KB
testcase_18 AC 1,396 ms
235,080 KB
testcase_19 AC 1,403 ms
235,196 KB
testcase_20 AC 37 ms
53,460 KB
testcase_21 AC 37 ms
53,460 KB
testcase_22 AC 1,415 ms
235,196 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int,input().split())
from collections import defaultdict
dic1 = defaultdict(int)
dic2 = defaultdict(int)
for i in range(1,N+1):
    for j in range(1,N+1):
        dic1[i*i+j*j] += 1
        dic2[D+j*j-i*i] += 1
ans = 0
for k,v in dic1.items():
    if k in dic2:
        ans += v * dic2[k]
print(ans)

0