結果

問題 No.268 ラッピング(Easy)
ユーザー satanicsatanic
提出日時 2016-05-14 04:06:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,166 bytes
コンパイル時間 1,493 ms
コンパイル使用メモリ 166,172 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 08:10:59
合計ジャッジ時間 2,099 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
#define VAR(type, a) type a;std::cin>>a;
// VAR(int, x);
#define OUT(d) std::cout<<(d);
#define SP std::cout<<" ";
#define ENDL std::cout<<"\n";
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define MAT(type, c, m, n) std::vector<std::vector<type>> c(m, std::vector<type>(n));for(auto& r:c)for(auto& i:r)std::cin>>i;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using ll = long long;
ll Factrial(ll n){
    if(!n) return 1;
    return n*Factrial(n-1);
}

signed main(){
    INIT;
    VEC(int, l, 3);VAR(int, r);VAR(int, b);VAR(int, y);
    int ans = 1<<30;
    REP(i, 3){
        int red = 2*r*(l[i%3]+l[(i+1)%3]);
        REP(j, 3){
            if(i==j) continue;
            int blue = 2*b*(l[j%3]+l[(j+1)%3]);
            int yellow = 2*y*(l[(3-i-j)%3]+l[((3-i-j)+1)%3]);
            ans = std::min(ans, red+blue+yellow);
        }
    }
    OUT(ans)ENDL;   
    return 0;
}
0