結果

問題 No.91 赤、緑、青の石
ユーザー odan3240odan3240
提出日時 2016-01-15 19:33:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 36 ms / 5,000 ms
コード長 1,281 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 87,488 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 12:16:35
合計ジャッジ時間 2,180 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,380 KB
testcase_01 AC 19 ms
4,380 KB
testcase_02 AC 8 ms
4,376 KB
testcase_03 AC 13 ms
4,380 KB
testcase_04 AC 8 ms
4,376 KB
testcase_05 AC 15 ms
4,380 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 23 ms
4,376 KB
testcase_13 AC 21 ms
4,376 KB
testcase_14 AC 17 ms
4,380 KB
testcase_15 AC 16 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 35 ms
4,376 KB
testcase_26 AC 36 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 4 ms
4,380 KB
testcase_29 AC 5 ms
4,380 KB
testcase_30 AC 24 ms
4,384 KB
testcase_31 AC 33 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int R,G,B;
int cnt(int n) {
    int ret=0;
    if(R>=n) ret++;
    if(G>=n) ret++;
    if(B>=n) ret++;
    return ret;
}
int main() {
    cin>>R>>G>>B;
    int s=min({R,G,B});
    int t=max({R,G,B});
    int m=R^G^B^s^t;
    int ans=s;
    for(int i=s+1;i<=t;i++) {
        int a=cnt(i);
        if(a==1) {
            int b=t-i;
            b/=2;
            b-=i-s;
            b-=i-m;
            if(b>=0) ans=max(ans,i);
        }
        if(a==2) {
            int b=s-i;
            b+=(t-i)/2;
            b+=(m-i)/2;
            if(b>=0) ans=max(ans,i);
        }
        if(a==0) break;
    }
    cout<<ans<<endl;
    return 0;
}
0