結果

問題 No.2730 Two Types Luggage
ユーザー umezoumezo
提出日時 2024-04-19 22:11:27
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 730 bytes
コンパイル時間 3,549 ms
コンパイル使用メモリ 280,820 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-04-19 22:11:54
合計ジャッジ時間 10,409 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 5 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 7 ms
5,376 KB
testcase_11 AC 159 ms
14,840 KB
testcase_12 AC 276 ms
18,600 KB
testcase_13 AC 127 ms
12,544 KB
testcase_14 AC 157 ms
14,720 KB
testcase_15 AC 106 ms
6,400 KB
testcase_16 AC 60 ms
7,424 KB
testcase_17 AC 203 ms
18,048 KB
testcase_18 AC 189 ms
16,768 KB
testcase_19 AC 16 ms
5,376 KB
testcase_20 AC 72 ms
8,812 KB
testcase_21 AC 146 ms
14,208 KB
testcase_22 AC 207 ms
18,508 KB
testcase_23 AC 22 ms
5,376 KB
testcase_24 AC 86 ms
9,600 KB
testcase_25 AC 164 ms
14,848 KB
testcase_26 AC 44 ms
6,272 KB
testcase_27 AC 158 ms
14,208 KB
testcase_28 AC 82 ms
9,216 KB
testcase_29 AC 197 ms
16,896 KB
testcase_30 AC 77 ms
5,376 KB
testcase_31 AC 121 ms
12,288 KB
testcase_32 AC 110 ms
11,264 KB
testcase_33 AC 277 ms
18,688 KB
testcase_34 AC 276 ms
18,944 KB
testcase_35 AC 289 ms
18,816 KB
testcase_36 AC 276 ms
18,816 KB
testcase_37 AC 280 ms
18,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
template <class T> using V=vector<T>;
template <class T> using VV=V<V<T>>; //B(n,V<int>(n))
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,m,w;
  cin>>n>>m>>w;
  V<ll> A(n),B(m),C(m);
  rep(i,n) cin>>A[i];
  rep(i,m) cin>>B[i];
  rep(i,m) cin>>C[i];
  sort(ALL(A));
  reverse(ALL(A));
  V<ll> S(n+1);
  rep(i,n) S[i+1]=S[i]+A[i];
  
  ll ans=0;
  for(int bit=0;bit<(1<<m);bit++){
    ll b=0,c=0;
    rep(i,m){
      if(bit&(1<<i)) b+=B[i],c+=C[i];
    }
    if(b>w) continue;
    ans=max(ans,c+S[min(w-b,n)]);
  }
  cout<<ans<<endl;
    
  return 0;
}
0