結果
問題 |
No.800 四平方定理
|
ユーザー |
|
提出日時 | 2020-08-29 19:40:08 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 343 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 82,528 KB |
実行使用メモリ | 654,844 KB |
最終ジャッジ日時 | 2024-11-14 17:39:16 |
合計ジャッジ時間 | 47,017 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 8 MLE * 2 |
ソースコード
N, D = map(int, input().split()) from collections import defaultdict X = defaultdict(int) Y = defaultdict(int) ans = 0 for i in range(1, N + 1): for j in range(1, N + 1): X[i ** 2 + j ** 2] += 1 Y[i ** 2 - j ** 2 + D] += 1 for k, v in Y.items(): ans += v * X[k] print(ans)