結果

問題 No.2730 Two Types Luggage
ユーザー pia-19pia-19
提出日時 2024-04-19 21:55:27
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,055 bytes
コンパイル時間 3,651 ms
コンパイル使用メモリ 281,092 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-19 21:56:03
合計ジャッジ時間 16,087 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 9 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 17 ms
5,376 KB
testcase_11 AC 379 ms
9,060 KB
testcase_12 AC 492 ms
11,008 KB
testcase_13 AC 285 ms
7,808 KB
testcase_14 AC 387 ms
8,988 KB
testcase_15 AC 99 ms
5,376 KB
testcase_16 AC 132 ms
5,504 KB
testcase_17 AC 496 ms
10,752 KB
testcase_18 AC 440 ms
9,984 KB
testcase_19 AC 37 ms
5,376 KB
testcase_20 AC 168 ms
5,888 KB
testcase_21 AC 709 ms
8,672 KB
testcase_22 AC 713 ms
10,848 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int INF = 1<<30;
const int MOD = 998244353;
//const long long INF = 1LL<<60;
using graph = vector<vector<int>>;
using ll = long long;


int main(){
    ll n, m, w;
    cin >> n >> m >> w;
    vector<ll> a(n), b(m), c(m);
    for (int i=0; i < n; i++) cin >> a[i];
    for (int i=0; i < m; i++) cin >> b[i];
    for (int i=0; i < m; i++) cin >> c[i];
    sort(a.begin(), a.end(), greater<ll>());
    
    ll ans = 0LL;
    for (int i=0; i < (1<<m); i++){
        ll weight = 0;
        ll value = 0;
        bool flag = true;
        for (int j=0; j < m; j++){
            if (i & (1<<j)){
                weight += b[j];
                value += c[j];
            }
            if (weight > w){
                flag = false;
                break;
            }
        }
        
        if (flag){
            ll rem = w - weight;
            for (int i=0; i < min(rem, n); i++){
                value += a[i];
            }
            ans = max(ans, value);
        }
    }
    cout << ans << endl;
}
0