結果

問題 No.2730 Two Types Luggage
ユーザー otoshigootoshigo
提出日時 2024-04-19 21:28:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,050 bytes
コンパイル時間 2,268 ms
コンパイル使用メモリ 202,076 KB
実行使用メモリ 19,048 KB
最終ジャッジ日時 2024-04-19 21:28:40
合計ジャッジ時間 15,096 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int N,M;
    ll 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];
    ll ans=0;
    sort(rall(A));
    vector<ll>S(N+1);
    for(int i=0;i<N;i++)S[i+1]=S[i]+A[i];
    for(int bit=0;bit<1<<M;bit++){
        ll wt=0,cost=0;
        for(int i=0;i<N;i++){
            if(bit>>i&1){
                wt+=B[i];
                cost+=C[i];
            }
        }
        if(wt>W)continue;
        cost+=S[min((ll)N,W-wt)];
        chmax(ans,cost);
    }
    cout<<ans<<"\n";
}
0