結果
| 問題 |
No.2632 Center of Three Points in Lp Norm
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-16 23:02:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 551 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 126,432 KB |
| 最終ジャッジ日時 | 2024-09-28 21:38:14 |
| 合計ジャッジ時間 | 58,419 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 WA * 8 TLE * 1 |
ソースコード
import numpy as np
import scipy
p = float(input())
ax, ay = map(float, input().split())
bx, by = map(float, input().split())
cx, cy = map(float, input().split())
def my_pow(x):
return np.abs(x) ** p
def f(point):
x, y = point
# print(x, y)
anorm = my_pow(ax - x) + my_pow(ay - y)
bnorm = my_pow(bx - x) + my_pow(by - y)
cnorm = my_pow(cx - x) + my_pow(cy - y)
return max(anorm, bnorm, cnorm) - min(anorm, bnorm, cnorm)
ans = scipy.optimize.fmin(f, [-100000, 100000], disp=False, maxiter=1000, ftol=1e-9)
print(*ans)