結果

問題 No.2730 Two Types Luggage
ユーザー GGanariGGanari
提出日時 2024-04-19 21:42:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 303 ms / 2,000 ms
コード長 1,087 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 200,808 KB
実行使用メモリ 34,452 KB
最終ジャッジ日時 2024-04-19 21:42:23
合計ジャッジ時間 9,103 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 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 6 ms
5,376 KB
testcase_05 AC 2 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 8 ms
5,376 KB
testcase_11 AC 163 ms
26,496 KB
testcase_12 AC 288 ms
34,176 KB
testcase_13 AC 132 ms
21,708 KB
testcase_14 AC 165 ms
26,368 KB
testcase_15 AC 109 ms
9,216 KB
testcase_16 AC 65 ms
11,776 KB
testcase_17 AC 214 ms
32,896 KB
testcase_18 AC 193 ms
30,464 KB
testcase_19 AC 19 ms
5,760 KB
testcase_20 AC 80 ms
14,080 KB
testcase_21 AC 156 ms
24,944 KB
testcase_22 AC 239 ms
33,920 KB
testcase_23 AC 26 ms
5,888 KB
testcase_24 AC 93 ms
15,856 KB
testcase_25 AC 170 ms
26,752 KB
testcase_26 AC 48 ms
9,728 KB
testcase_27 AC 156 ms
25,212 KB
testcase_28 AC 85 ms
15,104 KB
testcase_29 AC 195 ms
30,592 KB
testcase_30 AC 86 ms
6,016 KB
testcase_31 AC 129 ms
21,376 KB
testcase_32 AC 125 ms
19,456 KB
testcase_33 AC 303 ms
34,448 KB
testcase_34 AC 287 ms
34,452 KB
testcase_35 AC 283 ms
34,356 KB
testcase_36 AC 286 ms
34,312 KB
testcase_37 AC 292 ms
34,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define INF 1000000001LL
#define LNF 1000000000000000001LL
#define MOD 998244353LL
#define MAX 1005
#define long long long
#define all(x) x.begin(),x.end()
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0); 
    cin.tie(0);
    
    long n,m,w;
    cin >> n >> m >> w;
    vector<long> a(n);
    vector<long> b(n);
    vector<long> c(n);
    vector<long> hap(n+1);

    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(all(a));
    reverse(all(a));
    for(int i = 0; i<n; i++)
        hap[i+1] = hap[i]+a[i];
    long res = 0;
    for(int i = 0; i<1<<m; i++)
    {
        long curW = 0;
        long curV = 0;
        for(int j = 0; j<m; j++)
        {
            if(i&(1<<j))
            {
                curW+=b[j];
                curV+=c[j];
            }
        }

        if(curW > w)
            continue;
        
        curV+=hap[min(n,w-curW)];
        res = max(res,curV);
    }
    cout << res << endl;




    return 0;
}
0