結果
| 問題 | 
                            No.800 四平方定理
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-04-09 20:00:32 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 313 bytes | 
| コンパイル時間 | 94 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 81,024 KB | 
| 最終ジャッジ日時 | 2024-07-04 18:53:10 | 
| 合計ジャッジ時間 | 40,445 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 TLE * 8 | 
ソースコード
N,D=map(int,input().split())
zw_list=[0]*(2*N**2+D+1)
ans=0
p_list=[]
for i in range(1,N+1):
    p_list.append(i**2)
for z in p_list:
    for w in p_list:
        cal=D-z+w
        if cal>0:
            zw_list[cal]+=1            
for x in p_list:
    for y in p_list:
        ans+=zw_list[x+y]
print(ans)