結果

問題 No.2309 [Cherry 5th Tune D] 夏の先取り
ユーザー t98slidert98slider
提出日時 2023-05-19 22:10:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,024 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 172,656 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 00:04:01
合計ジャッジ時間 4,295 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 15 ms
4,376 KB
testcase_21 AC 13 ms
4,376 KB
testcase_22 AC 14 ms
4,380 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 16 ms
4,376 KB
testcase_28 AC 16 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 17 ms
4,376 KB
testcase_46 AC 15 ms
4,376 KB
testcase_47 WA -
testcase_48 AC 1 ms
4,380 KB
testcase_49 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void solve(){
    ll ans = 0, w;
    vector<ll> a(3), b(3), c(3);
    for(auto &&v : a) cin >> v;
    for(auto &&v : b) cin >> v;
    cin >> w;
    vector<pair<int,int>> pa = {{0, 1}, {1, 2}, {2, 0}};
    int u, v;
    auto f = [&](){
        ll r = min(a[0], a[1]);
        r = min(r, a[2]);
        for(ll i = 0; i <= r; i++){
            do{
                ll tmp = i * w;
                for(int j = 0; j < 3; j++) c[j] = a[j];
                for(int j = 0; j < 3; j++){
                    tie(u, v) = pa[j];
                    ll d = min(c[u], c[v]);
                    c[u] -= d, c[v] -= d;
                    tmp += d * b[u];
                }
                ans = max(ans, tmp);
            }while(next_permutation(pa.begin(), pa.end()));
            a[0]--, a[1]--, a[2]--;
        }
    };
    f();
    cout << ans << '\n';
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T;
    cin >> T;
    while(T--) solve();
}
0