結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー Ysmr_Ry
提出日時 2014-12-24 14:04:56
言語 C++11
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 318µs
コード長 420 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 143 ms
コンパイル使用メモリ 49,584 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-19 04:10:40
合計ジャッジ時間 1,802 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<cstdio>
#include<algorithm>
#define rep(i,a) for(int i=0;i<(a);++i)

int R, G, B;

bool C( int n )
{ return (std::max(0,R-n)>>1)+(std::max(0,G-n)>>1)+(std::max(0,B-n)>>1) >= std::max(0,n-R)+std::max(0,n-G)+std::max(0,n-B); }

int main()
{
	scanf( "%d%d%d", &R, &G, &B );
	
	int lb = 0, ub = R+G+B+1;
	while( ub-lb > 1 )
	{
		int mid = (lb+ub)>>1;
		(C(mid)?lb:ub) = mid;
	}

	printf( "%d\n", lb );

	return 0;
}
0