結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2019-10-28 18:15:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 672 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 53,932 KB |
最終ジャッジ日時 | 2024-06-24 07:21:26 |
合計ジャッジ時間 | 2,299 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
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()