結果

問題 No.800 四平方定理
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-11-17 23:16:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 423 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 286,220 KB
最終ジャッジ日時 2023-11-17 23:17:20
合計ジャッジ時間 31,562 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
70,208 KB
testcase_01 AC 76 ms
77,464 KB
testcase_02 AC 69 ms
73,780 KB
testcase_03 AC 70 ms
76,568 KB
testcase_04 AC 68 ms
73,780 KB
testcase_05 AC 71 ms
75,584 KB
testcase_06 AC 78 ms
79,892 KB
testcase_07 AC 70 ms
76,472 KB
testcase_08 AC 79 ms
79,888 KB
testcase_09 AC 75 ms
77,564 KB
testcase_10 AC 969 ms
227,088 KB
testcase_11 AC 966 ms
240,872 KB
testcase_12 AC 967 ms
240,864 KB
testcase_13 AC 921 ms
213,644 KB
testcase_14 AC 1,003 ms
240,868 KB
testcase_15 AC 968 ms
240,864 KB
testcase_16 AC 1,022 ms
240,872 KB
testcase_17 AC 1,019 ms
240,876 KB
testcase_18 AC 943 ms
240,868 KB
testcase_19 AC 949 ms
240,872 KB
testcase_20 AC 44 ms
55,596 KB
testcase_21 AC 44 ms
55,596 KB
testcase_22 AC 1,022 ms
240,872 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 45 ms
55,596 KB
testcase_27 AC 43 ms
55,596 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 1,892 ms
273,864 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

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

A = defaultdict(int)
for i in range(1,N+1):
    i2 = i*i
    for j in range(1,N+1):
        j2 = j*j
        A[D + i2 - j2] += 1


ans = 0
for i in range(1,N+1):
    i2 = i*i
    for j in range(1,N+1):
        j2 = j*j
        ans += A[i2+j2]
print(ans)
0