結果

問題 No.91 赤、緑、青の石
ユーザー roknaoroknao
提出日時 2019-10-28 18:15:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 71,612 KB
最終ジャッジ日時 2023-09-06 12:43:56
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,404 KB
testcase_01 AC 70 ms
71,336 KB
testcase_02 AC 71 ms
71,448 KB
testcase_03 AC 71 ms
71,452 KB
testcase_04 AC 69 ms
71,544 KB
testcase_05 AC 69 ms
71,336 KB
testcase_06 AC 70 ms
71,360 KB
testcase_07 AC 69 ms
71,148 KB
testcase_08 AC 72 ms
71,192 KB
testcase_09 AC 69 ms
71,424 KB
testcase_10 AC 73 ms
71,396 KB
testcase_11 AC 72 ms
71,400 KB
testcase_12 AC 72 ms
71,136 KB
testcase_13 AC 71 ms
71,304 KB
testcase_14 AC 71 ms
71,520 KB
testcase_15 AC 70 ms
71,488 KB
testcase_16 AC 70 ms
71,612 KB
testcase_17 AC 70 ms
71,500 KB
testcase_18 AC 71 ms
71,516 KB
testcase_19 AC 70 ms
71,524 KB
testcase_20 AC 71 ms
71,308 KB
testcase_21 AC 69 ms
71,312 KB
testcase_22 AC 71 ms
71,328 KB
testcase_23 AC 69 ms
71,380 KB
testcase_24 AC 70 ms
71,236 KB
testcase_25 AC 70 ms
71,428 KB
testcase_26 AC 70 ms
71,296 KB
testcase_27 AC 71 ms
71,512 KB
testcase_28 AC 71 ms
71,424 KB
testcase_29 AC 71 ms
71,460 KB
testcase_30 AC 71 ms
71,452 KB
testcase_31 AC 71 ms
71,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline


def main():
    def isOK(m):
        r = R - m
        g = G - m
        b = B - m
        cnt = 0
        for s in [r, g, b]:
            if s>=0:
                cnt += s//2
        for s in [r, g, b]:
            if s<0:
                cnt += s
        return cnt >= 0


    def binary_search(ok, ng):
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if isOK(mid):
                ok = mid
            else:
                ng = mid
        return ok
    

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

    ok = -1
    ng = 10000010
    print(binary_search(ok, ng))


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