結果

問題 No.800 四平方定理
ユーザー mkawa2mkawa2
提出日時 2021-02-13 17:09:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 367 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 10,576 KB
実行使用メモリ 70,572 KB
最終ジャッジ日時 2023-09-28 01:40:48
合計ジャッジ時間 31,766 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
8,488 KB
testcase_01 AC 47 ms
9,052 KB
testcase_02 AC 33 ms
8,756 KB
testcase_03 AC 36 ms
8,796 KB
testcase_04 AC 36 ms
8,836 KB
testcase_05 AC 38 ms
8,708 KB
testcase_06 AC 49 ms
9,292 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 43 ms
9,384 KB
testcase_10 AC 1,059 ms
39,120 KB
testcase_11 AC 1,070 ms
42,804 KB
testcase_12 AC 1,241 ms
42,040 KB
testcase_13 AC 900 ms
40,236 KB
testcase_14 AC 1,068 ms
42,780 KB
testcase_15 AC 1,227 ms
42,576 KB
testcase_16 AC 1,001 ms
43,044 KB
testcase_17 AC 1,103 ms
43,080 KB
testcase_18 AC 1,301 ms
43,028 KB
testcase_19 AC 1,372 ms
43,040 KB
testcase_20 AC 14 ms
7,892 KB
testcase_21 RE -
testcase_22 AC 1,402 ms
43,092 KB
testcase_23 TLE -
testcase_24 AC 1,837 ms
70,572 KB
testcase_25 TLE -
testcase_26 AC 15 ms
7,740 KB
testcase_27 RE -
testcase_28 AC 1,981 ms
70,192 KB
testcase_29 TLE -
testcase_30 AC 1,951 ms
70,080 KB
testcase_31 AC 1,820 ms
65,864 KB
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**6)
def MI(): return map(int, sys.stdin.buffer.readline().split())

n, d = MI()
cnt = [0]*(2*n*n+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 < 0: break
        ans += cnt[t]

print(ans)
0