結果

問題 No.91 赤、緑、青の石
ユーザー 0w1
提出日時 2016-11-20 16:31:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 1,404 ms
コンパイル使用メモリ 168,752 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-27 09:02:17
合計ジャッジ時間 2,573 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 4 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

signed main(){
  int R, G, B; cin >> R >> G >> B;
  int ans = min( { R, G, B } );
  R -= ans, G -= ans, B -= ans;
  if( R + G > 0 and G + B > 0 and R + B > 0 ){
    int v[ 3 ] = { R, G, B }; sort( v, v + 3 );
    int lb = 0, rb = ( int ) 1e7;
    int z = 0;
    while( lb <= rb ){
      int mid = lb + rb >> 1;
      int ok = 0;
      for( int i = 0; i <= mid; ++i ){
        if( v[ 1 ] - 2 * i < mid )
          break;
        if( v[ 2 ] - 2 * ( mid - i ) >= mid )
          ok = 1;
      }
      if( ok )
        z = mid, lb = mid + 1;
      else
        rb = mid - 1;
    }
    ans += z;
  }
  ans += max( { R, G, B } ) / 5;
  cout << ans << endl;
  return 0;
}
0