結果

問題 No.306 さいたま2008
ユーザー T0RA1107T0RA1107
提出日時 2021-10-09 15:20:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 7,992 KB
最終ジャッジ日時 2023-10-10 00:44:39
合計ジャッジ時間 1,655 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,724 KB
testcase_01 AC 15 ms
7,724 KB
testcase_02 AC 15 ms
7,792 KB
testcase_03 AC 15 ms
7,784 KB
testcase_04 AC 14 ms
7,880 KB
testcase_05 AC 14 ms
7,796 KB
testcase_06 AC 15 ms
7,820 KB
testcase_07 AC 14 ms
7,788 KB
testcase_08 AC 15 ms
7,924 KB
testcase_09 AC 15 ms
7,876 KB
testcase_10 AC 17 ms
7,800 KB
testcase_11 AC 16 ms
7,724 KB
testcase_12 AC 15 ms
7,784 KB
testcase_13 AC 13 ms
7,828 KB
testcase_14 AC 14 ms
7,768 KB
testcase_15 AC 14 ms
7,792 KB
testcase_16 AC 13 ms
7,936 KB
testcase_17 AC 14 ms
7,832 KB
testcase_18 AC 14 ms
7,888 KB
testcase_19 AC 14 ms
7,796 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 14 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def from_read():
    return [int(x) for x in read().splitlines()]

def from_readline():
    return [int(x) for x in readline().split()]

def read_matrix(N, M):
    matrix = [None for i in range(N)]
    for i in range(N):
        matrix[i] = from_readline()
    return matrix

def solve(xa, ya, xb, yb):
    l = -100
    r = 1000
    for _ in range(300):
        c1 = (2*l + r) / 3
        c2 = (l + 2*r) / 3
        L1 = (xa**2 + (c1 - ya)**2)**.5 + (xb**2 + (c1 - yb)**2)**.5
        L2 = (xa**2 + (c2 - ya)**2)**.5 + (xb**2 + (c2 - yb)**2)**.5
        if L1 > L2: l = c1
        else: r = c2
    return l

def main():
    xa, ya = from_readline()
    xb, yb = from_readline()
    print(solve(xa, ya, xb, yb))

if __name__ == "__main__":
    main()

0