結果

問題 No.800 四平方定理
ユーザー mkawa2mkawa2
提出日時 2021-02-13 17:11:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,171 bytes
コンパイル時間 872 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 70,760 KB
最終ジャッジ日時 2023-09-28 01:43:46
合計ジャッジ時間 38,221 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
9,036 KB
testcase_01 AC 52 ms
9,576 KB
testcase_02 AC 39 ms
9,244 KB
testcase_03 AC 44 ms
9,304 KB
testcase_04 AC 42 ms
9,024 KB
testcase_05 AC 44 ms
9,224 KB
testcase_06 AC 57 ms
9,720 KB
testcase_07 AC 58 ms
9,240 KB
testcase_08 AC 59 ms
9,640 KB
testcase_09 AC 52 ms
9,452 KB
testcase_10 AC 1,308 ms
39,156 KB
testcase_11 AC 1,376 ms
42,984 KB
testcase_12 AC 1,531 ms
42,500 KB
testcase_13 AC 1,195 ms
40,736 KB
testcase_14 AC 1,266 ms
43,044 KB
testcase_15 AC 1,454 ms
42,868 KB
testcase_16 AC 1,270 ms
43,392 KB
testcase_17 AC 1,279 ms
43,360 KB
testcase_18 AC 1,645 ms
43,292 KB
testcase_19 AC 1,610 ms
43,336 KB
testcase_20 AC 16 ms
8,232 KB
testcase_21 AC 16 ms
8,116 KB
testcase_22 AC 1,642 ms
43,384 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 16 ms
8,268 KB
testcase_27 AC 16 ms
8,316 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def FI(): return float(sys.stdin.buffer.readline())
def MI(): return map(int, sys.stdin.buffer.readline().split())
def MF(): return map(float, sys.stdin.buffer.readline().split())
def MI1(): return map(int1, sys.stdin.buffer.readline().split())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
inf = 10**16
# md = 998244353
md = 10**9+7

n, d = MI()
lim = 2*n*n
cnt = [0]*(lim+1)

for x in range(1, n+1):
    for y in range(1, n+1):
        cnt[x*x+y*y] += 1

ans = 0
for w in range(1, n+1):
    s = w*w+d
    for z in range(1, n+1):
        t = s-z*z
        if t > lim: continue
        if t < 0: break
        ans += cnt[t]

print(ans)
0