結果

問題 No.800 四平方定理
ユーザー Ueki
提出日時 2019-03-17 23:28:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 424 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 792,008 KB
最終ジャッジ日時 2024-07-08 03:26:57
合計ジャッジ時間 40,167 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 3
other TLE * 1 MLE * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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


def solve2():
    p = [x**2 for x in range(1, N+1)]
    cnt = [0]*10**8

    for w in p:
        for z in p:
            tmp = w-z+D
            if tmp > 0:
                cnt[tmp] += 1

    ans = 0
    for x in p:
        for y in p:
            ans += cnt[x+y]
    print(ans)


solve2()
0