結果

問題 No.800 四平方定理
ユーザー tobusakanatobusakana
提出日時 2022-10-02 17:17:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 446 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 380,784 KB
最終ジャッジ日時 2023-08-26 15:16:39
合計ジャッジ時間 23,822 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
81,220 KB
testcase_01 AC 119 ms
85,456 KB
testcase_02 AC 120 ms
83,160 KB
testcase_03 AC 116 ms
83,904 KB
testcase_04 AC 115 ms
82,060 KB
testcase_05 AC 116 ms
83,672 KB
testcase_06 AC 124 ms
88,248 KB
testcase_07 AC 120 ms
84,924 KB
testcase_08 AC 125 ms
88,240 KB
testcase_09 AC 123 ms
86,220 KB
testcase_10 AC 1,002 ms
248,112 KB
testcase_11 AC 1,154 ms
254,812 KB
testcase_12 AC 1,008 ms
250,968 KB
testcase_13 AC 954 ms
252,268 KB
testcase_14 AC 1,015 ms
254,596 KB
testcase_15 AC 1,085 ms
252,652 KB
testcase_16 AC 1,040 ms
257,428 KB
testcase_17 AC 1,151 ms
257,612 KB
testcase_18 AC 1,044 ms
255,588 KB
testcase_19 AC 1,067 ms
255,904 KB
testcase_20 AC 86 ms
71,492 KB
testcase_21 AC 89 ms
71,372 KB
testcase_22 AC 1,114 ms
257,620 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 90 ms
71,892 KB
testcase_27 AC 85 ms
71,732 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,971 ms
349,788 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int,input().split())

from collections import defaultdict
left = defaultdict(int)
for x in range(1, N + 1):
    for y in range(1, N + 1):
        left[x**2 + y**2] += 1
        
right = defaultdict(int)
for w in range(1, N + 1):
    for z in range(1, N + 1):
        right[w**2 - z**2 + D] += 1
        
ans = 0
for key, value in left.items():
    if key in right:
        ans += right[key] * value
        
print(ans)
        
        
0