結果

問題 No.2730 Two Types Luggage
ユーザー CaiiiiiiiiCaiiiiiiii
提出日時 2024-04-19 22:45:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 299 ms / 2,000 ms
コード長 818 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 205,160 KB
実行使用メモリ 18,944 KB
最終ジャッジ日時 2024-04-19 22:45:45
合計ジャッジ時間 8,913 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 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 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 7 ms
5,376 KB
testcase_11 AC 155 ms
14,848 KB
testcase_12 AC 284 ms
18,560 KB
testcase_13 AC 121 ms
12,416 KB
testcase_14 AC 164 ms
14,976 KB
testcase_15 AC 102 ms
6,400 KB
testcase_16 AC 57 ms
7,552 KB
testcase_17 AC 196 ms
18,048 KB
testcase_18 AC 182 ms
16,896 KB
testcase_19 AC 16 ms
5,376 KB
testcase_20 AC 73 ms
8,704 KB
testcase_21 AC 148 ms
14,336 KB
testcase_22 AC 211 ms
18,688 KB
testcase_23 AC 23 ms
5,376 KB
testcase_24 AC 88 ms
9,728 KB
testcase_25 AC 160 ms
15,104 KB
testcase_26 AC 45 ms
6,400 KB
testcase_27 AC 151 ms
14,336 KB
testcase_28 AC 80 ms
9,344 KB
testcase_29 AC 190 ms
16,896 KB
testcase_30 AC 85 ms
5,376 KB
testcase_31 AC 121 ms
12,416 KB
testcase_32 AC 107 ms
11,264 KB
testcase_33 AC 290 ms
18,944 KB
testcase_34 AC 283 ms
18,944 KB
testcase_35 AC 278 ms
18,944 KB
testcase_36 AC 299 ms
18,944 KB
testcase_37 AC 279 ms
18,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

typedef long long LL;
typedef __int128 LLL;

const int N = 10;
const int MOD = 998244353;

int main() {

  int n, m;
  LL k;
  scanf("%d%d%lld", &n, &m, &k);

  std::vector<LL> a(n);
  for(LL &v: a)
    scanf("%lld", &v);
  std::sort(a.begin(), a.end(), std::greater<LL>());
  a.insert(a.begin(), 0);
  for(int i = 1; i < a.size(); ++i)
    a[i] += a[i - 1];

  std::vector<std::pair<int, int>> b(m);
  for(auto &[x, y]: b)
    scanf("%d", &y);
  for(auto &[x, y]: b)
    scanf("%d", &x);
  
  LL ans = 0;
  for(int i = 0; i < (1 << m); ++i) {
    LL v = 0, w = 0;
    for(int j = 0; j < m; ++j)
      if(i >> j & 1)
	v += b[j].first, w += b[j].second;
    if(w <= k) 
      ans = std::max(ans, v + (k - w < a.size() ? a[k - w] : a.back()));
  }
  
  printf("%lld\n", ans);
  
  return 0;

}
0