結果

問題 No.91 赤、緑、青の石
ユーザー sekiya9311sekiya9311
提出日時 2016-06-18 05:16:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,606 bytes
コンパイル時間 1,025 ms
コンパイル使用メモリ 106,368 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 02:38:53
合計ジャッジ時間 11,079 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 683 ms
5,248 KB
testcase_01 AC 458 ms
5,376 KB
testcase_02 AC 273 ms
5,376 KB
testcase_03 AC 501 ms
5,376 KB
testcase_04 AC 238 ms
5,376 KB
testcase_05 AC 572 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 168 ms
5,376 KB
testcase_12 AC 549 ms
5,376 KB
testcase_13 AC 592 ms
5,376 KB
testcase_14 AC 393 ms
5,376 KB
testcase_15 AC 660 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 972 ms
5,376 KB
testcase_26 AC 880 ms
5,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 646 ms
5,376 KB
testcase_31 AC 872 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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()>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;
    }
    cout<<low<<endl;
}
0