結果

問題 No.91 赤、緑、青の石
ユーザー しらっ亭
提出日時 2016-03-23 15:35:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 480 bytes
コンパイル時間 212 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-24 06:56:51
合計ジャッジ時間 2,205 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    RGB = list(map(int, input().split()))
    RGB.sort()
    a, b, c = RGB

    def check(x):
        if b >= x:
            d = a + (b - x) // 2
            rest = c - (x - d) * 2
        else:
            rest = c - (x - a) * 2 - (x - b) * 2
        return rest >= x

    l = 0
    r = c + 1

    while r - l > 1:
        m = (r + l) // 2
        if check(m):
            l = m
        else:
            r = m

    print(l)


if __name__ == '__main__':
    solve()
0