結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,804 KB
testcase_01 AC 69 ms
71,532 KB
testcase_02 AC 73 ms
71,296 KB
testcase_03 AC 67 ms
71,804 KB
testcase_04 AC 70 ms
71,264 KB
testcase_05 AC 69 ms
71,564 KB
testcase_06 AC 70 ms
71,632 KB
testcase_07 AC 68 ms
71,508 KB
testcase_08 AC 69 ms
71,784 KB
testcase_09 AC 69 ms
71,788 KB
testcase_10 AC 69 ms
71,800 KB
testcase_11 AC 69 ms
71,496 KB
testcase_12 AC 69 ms
71,536 KB
testcase_13 AC 69 ms
71,312 KB
testcase_14 AC 68 ms
71,848 KB
testcase_15 AC 69 ms
71,360 KB
testcase_16 AC 70 ms
71,900 KB
testcase_17 AC 70 ms
71,720 KB
testcase_18 AC 69 ms
71,828 KB
testcase_19 AC 68 ms
71,324 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 70 ms
71,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def ternary_search_min(l, r, evaluate):
    EPS = 10 ** (-6)
    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