結果
問題 | No.2632 Center of Three Points in Lp Norm |
ユーザー | suisen |
提出日時 | 2024-02-16 23:37:39 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,208 bytes |
コンパイル時間 | 240 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 81,868 KB |
最終ジャッジ日時 | 2024-02-16 23:37:58 |
合計ジャッジ時間 | 9,612 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 167 ms
81,868 KB |
testcase_01 | AC | 167 ms
81,868 KB |
testcase_02 | AC | 166 ms
81,868 KB |
testcase_03 | AC | 164 ms
81,868 KB |
testcase_04 | AC | 165 ms
81,868 KB |
testcase_05 | AC | 191 ms
81,868 KB |
testcase_06 | AC | 169 ms
81,868 KB |
testcase_07 | WA | - |
testcase_08 | AC | 166 ms
81,868 KB |
testcase_09 | AC | 165 ms
81,868 KB |
testcase_10 | AC | 162 ms
81,868 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 167 ms
81,868 KB |
testcase_14 | WA | - |
testcase_15 | AC | 161 ms
81,868 KB |
testcase_16 | AC | 192 ms
81,868 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 194 ms
81,868 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 165 ms
81,868 KB |
testcase_25 | WA | - |
testcase_26 | AC | 165 ms
81,868 KB |
testcase_27 | AC | 168 ms
81,868 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 162 ms
81,868 KB |
testcase_31 | AC | 163 ms
81,868 KB |
testcase_32 | AC | 163 ms
81,868 KB |
testcase_33 | AC | 163 ms
81,868 KB |
testcase_34 | AC | 148 ms
81,356 KB |
testcase_35 | AC | 160 ms
81,868 KB |
testcase_36 | AC | 191 ms
81,868 KB |
testcase_37 | AC | 163 ms
81,868 KB |
ソースコード
from decimal import Decimal, getcontext, setcontext Fp = float getcontext().prec = 12 p = Fp(input()) ax, ay = map(Fp, input().split()) bx, by = map(Fp, input().split()) cx, cy = map(Fp, input().split()) def norm(x1: Fp, y1: Fp, x2: Fp, y2: Fp): return (abs(x1 - x2) ** p + abs(y1 - y2) ** p) ** (Fp(1) / p) def max_norm(x: Fp, y: Fp): a = norm(x, y, ax, ay) b = norm(x, y, bx, by) c = norm(x, y, cx, cy) return abs(a - b) ** 2 + abs(b - c) ** 2 + abs(c - a) ** 2 def bsearch_y(x: Fp): ly, ry = Fp(-1000000), Fp(1000000) for _ in range(100): mly = ly + (ry - ly) / 3 mry = ry - (ry - ly) / 3 if max_norm(x, mly) > max_norm(x, mry): ly = mly else: ry = mry return max_norm(x, ly), ly def bsearch_x(): lx, rx = Fp(-1000000), Fp(1000000) for _ in range(100): mlx = lx + (rx - lx) / 3 mrx = rx - (rx - lx) / 3 if bsearch_y(mlx)[0] > bsearch_y(mrx)[0]: lx = mlx else: rx = mrx return lx, bsearch_y(lx)[1] x, y = bsearch_x() # print(norm(x, y, ax, ay)) # print(norm(x, y, bx, by)) # print(norm(x, y, cx, cy)) print(f'{x:.10f} {y:.10f}')