結果

問題 No.2730 Two Types Luggage
ユーザー cled0328cled0328
提出日時 2024-04-19 21:30:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 581 ms / 2,000 ms
コード長 629 bytes
コンパイル時間 2,689 ms
コンパイル使用メモリ 200,644 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-04-19 21:31:07
合計ジャッジ時間 14,487 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 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 18 ms
5,376 KB
testcase_11 AC 364 ms
14,848 KB
testcase_12 AC 538 ms
18,560 KB
testcase_13 AC 313 ms
12,416 KB
testcase_14 AC 377 ms
14,848 KB
testcase_15 AC 170 ms
6,272 KB
testcase_16 AC 132 ms
7,424 KB
testcase_17 AC 476 ms
17,920 KB
testcase_18 AC 428 ms
16,768 KB
testcase_19 AC 37 ms
5,376 KB
testcase_20 AC 168 ms
8,576 KB
testcase_21 AC 338 ms
14,208 KB
testcase_22 AC 509 ms
18,560 KB
testcase_23 AC 50 ms
5,376 KB
testcase_24 AC 209 ms
9,600 KB
testcase_25 AC 380 ms
14,976 KB
testcase_26 AC 105 ms
6,400 KB
testcase_27 AC 360 ms
14,208 KB
testcase_28 AC 194 ms
9,344 KB
testcase_29 AC 418 ms
17,024 KB
testcase_30 AC 105 ms
5,376 KB
testcase_31 AC 293 ms
12,288 KB
testcase_32 AC 240 ms
11,264 KB
testcase_33 AC 538 ms
18,816 KB
testcase_34 AC 562 ms
18,816 KB
testcase_35 AC 535 ms
18,816 KB
testcase_36 AC 581 ms
18,816 KB
testcase_37 AC 570 ms
18,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int n,m;cin>>n>>m;
    long long w;cin>>w;
    vector<long long> 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());
    vector<long long> s(n+1);
    for(int i=0;i<n;i++)s[i+1]=s[i]+a[n-1-i];
    long long ans=0;
    for(int i=0;i<(1<<m);i++){
        long long h=0,k=0;
        for(int j=0;j<m;j++)if(i&(1<<j)){
            h+=b[j];
            k+=c[j];
        }
        if(h>w)continue;
        ans=max(ans,k+s[min((long long)n,w-h)]);
    }
    cout<<ans<<"\n";
}
0