結果

問題 No.91 赤、緑、青の石
ユーザー sekiya9311sekiya9311
提出日時 2016-06-18 05:23:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,623 bytes
コンパイル時間 926 ms
コンパイル使用メモリ 107,632 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-18 02:39:32
合計ジャッジ時間 12,786 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 819 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 305 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 279 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 186 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 729 ms
5,376 KB
testcase_14 AC 436 ms
5,376 KB
testcase_15 AC 796 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1,159 ms
5,376 KB
testcase_26 AC 1,074 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>

#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define FOR(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define RREP(i,a) for(long (i)=(a)-1;(i)>=0;(i)--)
#define FORR(i,a,b) for(long (i)=(a)-1;(i)>=(b);(i)--)
#define MOD 1000000007
#define PI acos(-1.0)
#define DEBUG(C) cout<<C<<endl;
#define PII pair<int,int>
#define PLL pair<long,long>
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).begin(),(a).end(),greater<int>())
#define MP(a,b) make_pair(a,b)

typedef long long LL;
typedef unsigned long long ULL;

using namespace std;

bool func(int r,int g,int b,int num){
    vector<int> v{r,g,b};
    SORT(v);
    int cnt=v[0];
    REP(i,v.size()) v[i]-=cnt;
    while(v.back()>=5||(v.back()>2&&v[1]>0)){
        v.back()-=2;
        v.begin()++;
        REP(i,v.size()) v[i]--;
        cnt++;
        SORT(v);
    }
    if(cnt>=num) return true;
    else return false;
}

int main(void){
    int R,G,B; cin>>R>>G>>B;
    int high=1e7,low=0,mid;
    while(high-low>1){
        mid=(high+low)/2;
        if(func(R,G,B,mid)) low=mid;
        else high=mid-1;
    }
    cout<<low<<endl;
}
0