結果

問題 No.306 さいたま2008
ユーザー neterukunneterukun
提出日時 2021-06-15 23:16:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 71,904 KB
最終ジャッジ日時 2023-08-27 20:02:39
合計ジャッジ時間 2,929 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,852 KB
testcase_01 AC 71 ms
71,696 KB
testcase_02 AC 70 ms
71,316 KB
testcase_03 AC 69 ms
71,468 KB
testcase_04 AC 72 ms
71,612 KB
testcase_05 AC 70 ms
71,520 KB
testcase_06 AC 70 ms
71,512 KB
testcase_07 AC 69 ms
71,852 KB
testcase_08 AC 68 ms
71,632 KB
testcase_09 AC 68 ms
71,520 KB
testcase_10 AC 68 ms
71,608 KB
testcase_11 AC 69 ms
71,756 KB
testcase_12 AC 70 ms
71,848 KB
testcase_13 AC 69 ms
71,520 KB
testcase_14 AC 69 ms
71,648 KB
testcase_15 AC 71 ms
71,612 KB
testcase_16 AC 70 ms
71,700 KB
testcase_17 AC 71 ms
71,724 KB
testcase_18 AC 71 ms
71,516 KB
testcase_19 AC 68 ms
71,568 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 69 ms
71,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ternary_search_min(l, r, evaluate):
    EPS = 10 ** (-7)
    while r - l > EPS:
        midl = l + (r - l) / 3
        midr = r - (r - l) / 3
        if evaluate(midl) > evaluate(midr):
            l = midl
        else:
            r = midr
    return l, evaluate(l)


def solve(y):
    dist = ((ya - y) ** 2 + xa ** 2) ** 0.5 + ((yb - y) ** 2 + xb ** 2) ** 0.5
    return dist


xa, ya = map(int, input().split())
xb, yb = map(int, input().split())


y, dist = ternary_search_min(-10, 1000 + 10, solve)
print(y)
0