結果

問題 No.2730 Two Types Luggage
ユーザー Nzt3Nzt3
提出日時 2024-04-20 01:19:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 752 bytes
コンパイル時間 2,322 ms
コンパイル使用メモリ 203,928 KB
実行使用メモリ 20,600 KB
最終ジャッジ日時 2024-04-20 01:19:28
合計ジャッジ時間 8,935 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 5 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 7 ms
6,944 KB
testcase_11 AC 144 ms
15,572 KB
testcase_12 AC 276 ms
20,600 KB
testcase_13 AC 115 ms
12,880 KB
testcase_14 AC 157 ms
15,320 KB
testcase_15 AC 109 ms
6,944 KB
testcase_16 AC 60 ms
8,612 KB
testcase_17 AC 182 ms
18,492 KB
testcase_18 AC 168 ms
17,052 KB
testcase_19 AC 15 ms
6,944 KB
testcase_20 AC 67 ms
8,956 KB
testcase_21 AC 157 ms
15,328 KB
testcase_22 AC 189 ms
19,500 KB
testcase_23 AC 21 ms
6,940 KB
testcase_24 AC 79 ms
9,568 KB
testcase_25 AC 146 ms
16,216 KB
testcase_26 AC 40 ms
6,944 KB
testcase_27 AC 137 ms
14,860 KB
testcase_28 AC 74 ms
9,360 KB
testcase_29 AC 171 ms
18,868 KB
testcase_30 AC 79 ms
6,940 KB
testcase_31 AC 124 ms
13,664 KB
testcase_32 AC 103 ms
11,864 KB
testcase_33 AC 256 ms
20,056 KB
testcase_34 AC 259 ms
20,468 KB
testcase_35 AC 254 ms
19,860 KB
testcase_36 AC 263 ms
19,632 KB
testcase_37 AC 278 ms
19,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int MOD=998244353;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N,M;
  ll W;
  cin>>N>>M>>W;
  vector A(N,0ll);
  for(ll &i:A)cin>>i;
  sort(A.begin(),A.end());
  A.push_back(0);
  reverse(A.begin(),A.end());
  for(int i=1;i<=N;i++){
    A[i]+=A[i-1];
  }
  vector V(M,array<ll,2>());
  for(int i=0;i<M;i++)cin>>V[i][0];
  for(int i=0;i<M;i++)cin>>V[i][1];
  ll ans=0;
  for(int i=0;i<1<<M;i++){
    ll nowW=0,nowV=0;
    for(int j=0;j<M;j++){
      if(i>>j&1){
        nowW+=V[j][0];
        nowV+=V[j][1];
      }
    }
    if(nowW<=W){
      if(W-nowW>N) ans=max(ans,nowV+A[N]);
      else ans=max(ans,nowV+A[W-nowW]);
    }
  }
  cout<<ans<<'\n';
}
0