結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2020-02-02 22:26:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 30 ms / 5,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 254 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-06-24 07:24:10 |
合計ジャッジ時間 | 2,172 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 |
ソースコード
import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesR,G,B = sorted(map(int,read().split()))answer = RG,B = G-R,B-Rdef test(x,G,B):# x個作ることが可能である# まずは、G,B ともに Rに変換する場合if G >= x and B >= x:R = (G-x)//2 + (B-x)//2if R >= x:return True# BからR,Gに変換する場合B -= 2*xB -= max(0,2 * (x-G))return B >= xleft = 0 # 可能right = 10 ** 18while left + 1 < right:x = (left + right) // 2if test(x,G,B):left = xelse:right = xanswer += leftprint(answer)