結果
| 問題 |
No.800 四平方定理
|
| コンテスト | |
| ユーザー |
pasoconhoshii
|
| 提出日時 | 2019-03-18 00:53:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 507 bytes |
| コンパイル時間 | 134 ms |
| コンパイル使用メモリ | 82,120 KB |
| 実行使用メモリ | 266,292 KB |
| 最終ジャッジ日時 | 2024-07-08 07:52:06 |
| 合計ジャッジ時間 | 22,547 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 TLE * 1 |
ソースコード
N,D = map(int, input().split())
from collections import defaultdict
cnt = defaultdict(int)
lst = [ i**2 for i in range(1, N+1)]
for i in range(N):
for j in range(i,N):
if i == j:
cnt[ lst[i] + lst[j] ] += 1
else:
cnt[ lst[i] + lst[j] ] += 2
# else:
# cnt[ lst[i] + lst[j] ] += 2
ans = 0
for i in range(N):
for j in range(N):
x,y = lst[i], lst[j]
# if i == j :
ans += cnt[ y+D - x ]
print(ans)
pasoconhoshii