結果

問題 No.91 赤、緑、青の石
ユーザー DialBird
提出日時 2017-03-18 17:13:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 466 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-06-24 07:04:30
合計ジャッジ時間 2,026 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

stones = [int(i) for i in input().split()]

down = min(stones)
top = max(stones)

def binary_search(down, top):
    mid = (down + top) >> 1
    if mid == down:
        return mid
    lack = 0
    plus = 0
    for s in stones:
        if s <= mid:
            lack += mid - s
        else:
            plus += (s - mid) >> 1
    if lack <= plus:
        return binary_search(mid, top)
    else:
        return binary_search(down, mid)

print(binary_search(down, top))
0