結果

問題 No.800 四平方定理
ユーザー rlangevinrlangevin
提出日時 2022-08-20 11:31:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 286 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 316,800 KB
最終ジャッジ日時 2024-04-17 10:57:37
合計ジャッジ時間 20,306 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
67,840 KB
testcase_01 AC 80 ms
74,496 KB
testcase_02 AC 75 ms
70,784 KB
testcase_03 AC 77 ms
73,344 KB
testcase_04 AC 76 ms
70,272 KB
testcase_05 AC 78 ms
72,192 KB
testcase_06 AC 87 ms
77,568 KB
testcase_07 AC 79 ms
73,344 KB
testcase_08 AC 87 ms
77,568 KB
testcase_09 AC 80 ms
74,752 KB
testcase_10 AC 1,097 ms
265,880 KB
testcase_11 AC 1,119 ms
225,884 KB
testcase_12 AC 1,126 ms
225,876 KB
testcase_13 AC 1,108 ms
221,044 KB
testcase_14 AC 1,377 ms
225,496 KB
testcase_15 AC 1,424 ms
225,752 KB
testcase_16 AC 1,435 ms
225,624 KB
testcase_17 AC 1,167 ms
225,628 KB
testcase_18 AC 1,138 ms
225,240 KB
testcase_19 AC 1,140 ms
225,628 KB
testcase_20 AC 42 ms
53,248 KB
testcase_21 AC 43 ms
53,376 KB
testcase_22 AC 1,172 ms
225,116 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 46 ms
53,120 KB
testcase_27 AC 80 ms
53,248 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, D = map(int, input().split())
S = defaultdict(int)
for i in range(1, N + 1):
    for j in range(1, N + 1):
        S[D + i * i - j * j] += 1
        
ans = 0
for i in range(1, N + 1):
    for j in range(1, N + 1):
        ans += S[i * i + j * j]
print(ans)
0