結果

問題 No.800 四平方定理
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-03-18 00:24:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 449 bytes
コンパイル時間 1,243 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 309,096 KB
最終ジャッジ日時 2023-09-22 16:14:41
合計ジャッジ時間 27,817 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
81,728 KB
testcase_01 AC 131 ms
87,008 KB
testcase_02 AC 125 ms
83,196 KB
testcase_03 AC 129 ms
85,844 KB
testcase_04 AC 122 ms
83,080 KB
testcase_05 AC 124 ms
84,764 KB
testcase_06 AC 133 ms
89,008 KB
testcase_07 AC 127 ms
85,924 KB
testcase_08 AC 134 ms
89,160 KB
testcase_09 AC 128 ms
87,044 KB
testcase_10 AC 1,039 ms
262,488 KB
testcase_11 AC 1,089 ms
258,244 KB
testcase_12 AC 1,070 ms
257,812 KB
testcase_13 AC 1,081 ms
262,732 KB
testcase_14 AC 1,212 ms
258,200 KB
testcase_15 AC 1,230 ms
258,204 KB
testcase_16 AC 1,169 ms
258,248 KB
testcase_17 AC 1,188 ms
258,084 KB
testcase_18 AC 1,149 ms
258,188 KB
testcase_19 AC 1,197 ms
258,100 KB
testcase_20 AC 99 ms
71,380 KB
testcase_21 AC 96 ms
71,712 KB
testcase_22 AC 1,196 ms
257,968 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 95 ms
71,536 KB
testcase_27 AC 94 ms
71,876 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

from collections import defaultdict 
cnt = defaultdict(int)


lst = [ i**2 for i in range(1, N+1)]

for i in range(N):
    for j in range(N):
        # if i == j:
        cnt[ lst[i] + lst[j] ] += 1
        # else:
        #     cnt[ lst[i] + lst[j] ] += 2

ans = 0

for i in range(N):
    for j in range(N):
        x,y = lst[i], lst[j]
        # if i == j : 
        ans += cnt[ y+D - x ]

print(ans)
            
0