結果

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

ソースコード

diff #

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