結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー yomo3
提出日時 2020-03-06 19:36:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 361 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 91 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-12-07 12:35:38
合計ジャッジ時間 2,075 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

R, G, B = map(int, input().split())

ans = min(R, G, B)

R -= ans
G -= ans
B -= ans

l, r = 0, max(R, G, B) + 1

while r - l > 1:
    c = (l + r) // 2
    rest = 0
    for x in (R, G, B):
        if x > c:
            rest += (x - c) // 2
        elif x < c:
            rest -= c - x
    if rest >= 0:
        l = c
    else:
        r = c

ans += l
print(ans)
0