結果

問題 No.91 赤、緑、青の石
ユーザー k
提出日時 2020-07-24 03:36:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 539 bytes
コンパイル時間 2,052 ms
コンパイル使用メモリ 192,444 KB
最終ジャッジ日時 2025-01-12 04:52:04
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int cnt[3];
  REP (i, 3) cin >> cnt[i];

  int lo = 0;
  int hi = 1e8;

  while (hi - lo > 1) {
    int mi = lo + hi >> 1;

    int rem = 0;
    int sht = 0;
    REP (i, 3) {
      if (cnt[i] >= mi)
        rem += (cnt[i] - mi) / 2;
      else
        sht += mi - cnt[i];
    }

    if (rem >= sht)
      lo = mi;
    else
      hi = mi;
  }
  cout << lo << endl;
  
  return 0;
}
0