結果

問題 No.91 赤、緑、青の石
ユーザー rogi52rogi52
提出日時 2022-09-27 22:36:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 710 bytes
コンパイル時間 2,098 ms
コンパイル使用メモリ 203,468 KB
実行使用メモリ 768,476 KB
最終ジャッジ日時 2023-08-24 04:09:56
合計ジャッジ時間 12,560 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 378 ms
345,860 KB
testcase_02 AC 237 ms
219,112 KB
testcase_03 AC 427 ms
393,788 KB
testcase_04 AC 207 ms
190,636 KB
testcase_05 AC 502 ms
466,196 KB
testcase_06 AC 139 ms
129,220 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 146 ms
135,760 KB
testcase_12 AC 466 ms
430,380 KB
testcase_13 AC 500 ms
467,368 KB
testcase_14 AC 344 ms
314,736 KB
testcase_15 AC 540 ms
501,892 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 MLE -
testcase_26 MLE -
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 66 ms
63,520 KB
testcase_29 AC 146 ms
135,836 KB
testcase_30 MLE -
testcase_31 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    function<int(vector<int>)> dfs = [&](vector<int> A) -> int {
        int res = *min_element(A.begin(), A.end());
        rep(i,3) A[i] -= res;
        int argMax = max_element(A.begin(), A.end()) - A.begin();
        int argMin = min_element(A.begin(), A.end()) - A.begin();
        if(argMax == argMin || A[argMax] <= 1) return res;
        else {
            A[argMax] -= 2;
            A[argMin] += 1;
            return res + dfs(A);
        }
    };

    vector<int> A(3); rep(i,3) cin >> A[i];
    cout << dfs(A) << endl;
}
0