結果

問題 No.2632 Center of Three Points in Lp Norm
ユーザー maspymaspy
提出日時 2024-02-16 23:37:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 614 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 69,448 KB
最終ジャッジ日時 2024-02-16 23:38:19
合計ジャッジ時間 46,300 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,066 ms
69,440 KB
testcase_01 AC 1,060 ms
69,440 KB
testcase_02 AC 1,063 ms
69,440 KB
testcase_03 AC 1,060 ms
69,448 KB
testcase_04 AC 1,083 ms
69,440 KB
testcase_05 WA -
testcase_06 AC 1,058 ms
69,440 KB
testcase_07 AC 1,067 ms
69,432 KB
testcase_08 AC 1,068 ms
69,424 KB
testcase_09 AC 1,101 ms
69,424 KB
testcase_10 AC 1,110 ms
69,436 KB
testcase_11 WA -
testcase_12 AC 1,117 ms
69,440 KB
testcase_13 AC 1,083 ms
69,432 KB
testcase_14 WA -
testcase_15 AC 1,062 ms
69,440 KB
testcase_16 WA -
testcase_17 AC 1,034 ms
69,440 KB
testcase_18 AC 1,021 ms
69,440 KB
testcase_19 WA -
testcase_20 AC 1,028 ms
69,432 KB
testcase_21 AC 1,019 ms
69,440 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,066 ms
69,440 KB
testcase_25 WA -
testcase_26 AC 1,075 ms
69,424 KB
testcase_27 AC 1,059 ms
69,440 KB
testcase_28 WA -
testcase_29 AC 1,083 ms
69,424 KB
testcase_30 AC 1,050 ms
69,424 KB
testcase_31 AC 1,104 ms
69,436 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 1,035 ms
69,436 KB
testcase_35 WA -
testcase_36 AC 1,074 ms
67,332 KB
testcase_37 AC 1,081 ms
69,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scipy
from scipy import optimize

p = float(input())
x1, y1 = map(float, input().split())
x2, y2 = map(float, input().split())
x3, y3 = map(float, input().split())

def Lp(x,y):
    x = abs(x)
    y = abs(y)
    ma = max(x,y)
    if ma<1e-9:
        return 0
    x /= ma
    y /= ma
    x = x ** p
    y = y ** p
    return (x+y)**(1.0/p)*ma

def f(point):
    x, y = point
    d1 = Lp(x-x1,y-y1)
    d2 = Lp(x-x2,y-y2)
    d3 = Lp(x-x3,y-y3)
    return (d2 - d1) ** 2 + (d3 - d1) ** 2 + (d3 - d2) ** 2

options = {'maxiter': 10000}
x_min = optimize.minimize(f, x0=[0, 0], options=options)

print(*x_min.x)
0