結果

問題 No.2730 Two Types Luggage
ユーザー winguwingu
提出日時 2024-04-19 21:43:06
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 293 ms / 2,000 ms
コード長 1,587 bytes
コンパイル時間 3,548 ms
コンパイル使用メモリ 285,928 KB
実行使用メモリ 18,948 KB
最終ジャッジ日時 2024-04-19 21:43:25
合計ジャッジ時間 10,364 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 6 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 8 ms
6,944 KB
testcase_11 AC 160 ms
14,840 KB
testcase_12 AC 292 ms
18,640 KB
testcase_13 AC 130 ms
12,416 KB
testcase_14 AC 155 ms
14,904 KB
testcase_15 AC 110 ms
6,940 KB
testcase_16 AC 58 ms
7,296 KB
testcase_17 AC 191 ms
18,064 KB
testcase_18 AC 179 ms
16,880 KB
testcase_19 AC 17 ms
6,940 KB
testcase_20 AC 70 ms
8,536 KB
testcase_21 AC 157 ms
14,116 KB
testcase_22 AC 199 ms
18,524 KB
testcase_23 AC 21 ms
6,940 KB
testcase_24 AC 84 ms
9,688 KB
testcase_25 AC 151 ms
15,132 KB
testcase_26 AC 44 ms
6,944 KB
testcase_27 AC 145 ms
14,208 KB
testcase_28 AC 79 ms
9,148 KB
testcase_29 AC 193 ms
16,932 KB
testcase_30 AC 95 ms
6,944 KB
testcase_31 AC 120 ms
12,364 KB
testcase_32 AC 103 ms
11,212 KB
testcase_33 AC 270 ms
18,732 KB
testcase_34 AC 269 ms
18,940 KB
testcase_35 AC 272 ms
18,728 KB
testcase_36 AC 293 ms
18,948 KB
testcase_37 AC 270 ms
18,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma region template
#include<bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
using mint=modint998244353;
template<class T>inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep1(i,a) for(int i=0;i<(int)(a);i++)
#define rep2(i,a,b) for(int i =(int)(a);i<(int)(b);i++)
#define rep3(i,a,b,c) for(int i=(int)(a);i<(int)(b);i+=(int)(c))
#define overloadRep(a,b,c,d,e,...)e
#define rep(...) overloadRep(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define drep(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define spa " "
#define yes "Yes"
#define no "No"
#define int long long
const int inf=8e18;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
using P=pair<int,int>;
using T=tuple<int,int,int>;
bool bit(int &x,int &p){return (x>>p)&1;}

#pragma endregion

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(15);

    int n,m,w;cin>>n>>m>>w;
    vector<int>a(n),b(m),c(m);rep(i,n)cin>>a[i];rep(i,m)cin>>b[i];rep(i,m)cin>>c[i];

    vector<int>s(n+1);
    sort(rall(a));
    rep(i,n)s[i+1]+=s[i]+a[i];

    int ans=0;

    rep(i,1<<m){
        int nw=0,nv=0;
        rep(j,m)if(bit(i,j)){nw+=b[j];nv+=c[j];}
        if(nw>w)continue;

        int x=w-nw;
        x=min(x,n);
        nv+=s[x];
        chmax(ans,nv);
    }
    cout<<ans<<endl;
    return 0;
}
0