結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-02 17:19:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 610 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 552,492 KB |
| 最終ジャッジ日時 | 2024-12-25 13:23:00 |
| 合計ジャッジ時間 | 41,921 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 TLE * 7 MLE * 1 |
ソースコード
N,D = map(int,input().split())
from collections import defaultdict
left = defaultdict(int)
for x in range(1, N + 1):
for y in range(1, N + 1):
left[x**2 + y**2] += 1
right = defaultdict(int)
for w in range(1, N + 1):
for z in range(1, N + 1):
val = w**2 - z**2 + D
if val < 0:
break
right[w**2 - z**2 + D] += 1
ans = 0
for key, value in left.items():
if key in right:
ans += right[key] * value
print(ans)