結果
問題 | No.2632 Center of Three Points in Lp Norm |
ユーザー | NyaanNyaan |
提出日時 | 2024-02-16 23:05:41 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 699 bytes |
コンパイル時間 | 134 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 66,944 KB |
最終ジャッジ日時 | 2024-02-16 23:06:36 |
合計ジャッジ時間 | 52,968 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1,250 ms
66,896 KB |
testcase_01 | AC | 1,246 ms
66,924 KB |
testcase_02 | AC | 1,233 ms
66,896 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1,286 ms
66,876 KB |
testcase_05 | AC | 1,247 ms
66,896 KB |
testcase_06 | AC | 1,262 ms
66,928 KB |
testcase_07 | WA | - |
testcase_08 | AC | 1,253 ms
66,944 KB |
testcase_09 | AC | 1,520 ms
66,908 KB |
testcase_10 | AC | 1,234 ms
66,888 KB |
testcase_11 | WA | - |
testcase_12 | AC | 1,262 ms
66,916 KB |
testcase_13 | WA | - |
testcase_14 | AC | 1,491 ms
66,888 KB |
testcase_15 | AC | 1,268 ms
66,916 KB |
testcase_16 | WA | - |
testcase_17 | AC | 1,216 ms
66,896 KB |
testcase_18 | AC | 1,365 ms
66,884 KB |
testcase_19 | WA | - |
testcase_20 | AC | 1,231 ms
66,896 KB |
testcase_21 | AC | 1,271 ms
66,908 KB |
testcase_22 | WA | - |
testcase_23 | AC | 1,275 ms
66,884 KB |
testcase_24 | AC | 1,274 ms
66,896 KB |
testcase_25 | AC | 1,267 ms
66,896 KB |
testcase_26 | AC | 1,231 ms
66,896 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 1,250 ms
66,876 KB |
testcase_30 | AC | 1,250 ms
66,908 KB |
testcase_31 | WA | - |
testcase_32 | AC | 1,235 ms
66,896 KB |
testcase_33 | AC | 1,263 ms
66,876 KB |
testcase_34 | AC | 1,256 ms
66,916 KB |
testcase_35 | AC | 1,248 ms
66,896 KB |
testcase_36 | AC | 1,294 ms
66,932 KB |
testcase_37 | AC | 1,278 ms
66,924 KB |
ソースコード
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 = [] best = 1e9 for X in [-10**6, 10**6]: for Y in [-10**6, 10**6]: cur = scipy.optimize.fmin(f, [X, Y], disp=False, maxiter=1000, ftol=1e-6) if f(cur) < best: ans = cur best = f(cur) print(*ans)