結果

問題 No.91 赤、緑、青の石
ユーザー ytftytft
提出日時 2021-03-10 13:35:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,331 bytes
コンパイル時間 1,415 ms
コンパイル使用メモリ 166,964 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-20 08:51:00
合計ジャッジ時間 2,373 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
template<typename type>
void vector_sort(vector<type>& v,function<int(type)> fn=[](int a){return a;},int decided=0){
    int range=v.size()-decided;
    if(range==0){
        return;
    }
    int parent=(v.size()-decided-1)/2;
    int child=parent*2+1;
    int parent_depth=1;
    while(pow(2,parent_depth)-1<range){
        parent_depth++;
    }
    parent_depth-=2;
    type temp;
    while(parent_depth>=0){
        for(int i=pow(2,parent_depth)-1;i<pow(2,parent_depth+1)-1;i++){
            if(i*2+1<range && fn(v[i])<fn(v[i*2+1])){
                temp=v[i];
                v[i]=v[i*2+1];
                v[i*2+1]=temp;
            }
            if(i*2+2<range && fn(v[i])<fn(v[i*2+2])){
                temp=v[i];
                v[i]=v[i*2+2];
                v[i*2+2]=temp;
            }
        }
        parent_depth--;
    }
    temp=v[0];
    v[0]=v[range-1];
    v[range-1]=temp;
    vector_sort(v,fn,decided+1);
}

int main(){
    vector<int> num(3);
    cin>>num[0]>>num[1]>>num[2];
    vector_sort(num);
    int answer=0;
    num[1]-=num[0];
    num[2]-=num[0];
    answer+=num[0];
    num[0]=0;
    if(num[1]*3<=num[2]){
        answer+=num[1];
        num[2]-=num[1]*3;
        answer+=num[2]/5;
    }else{
        answer+=num[2]/3;
    }
    cout<<answer<<endl;
}
0