結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー GOTKAKO
提出日時 2025-06-30 05:59:29
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 900 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,495 ms
コンパイル使用メモリ 194,468 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-12-07 12:42:53
合計ジャッジ時間 2,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

template<typename T>
istream &operator>>(istream &is,vector<T> &a){
    for(auto &v : a) cin >> v;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &a){
    if(a.size() == 0) return os;
    cout << a.at(0);
    for(int i=1; i<a.size(); i++) cout << " " << a.at(i);
    cout << "\n";
    return os;
}

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

    int R,G,B; cin >> R >> G >> B;
    int low = 0,high = 10010010;
    while(high-low > 1){
        int mid = (high+low)/2;
        int over = 0;
        if(R >= mid) over += (R-mid)/2;
        else over += R-mid;
        if(G >= mid) over += (G-mid)/2;
        else over += G-mid;
        if(B >= mid) over += (B-mid)/2;
        else over += B-mid;

        if(over >= 0) low = mid;
        else high = mid;
    }
    cout << low << endl;
}
0