結果

問題 No.2730 Two Types Luggage
コンテスト
ユーザー KA37RI
提出日時 2024-04-19 21:54:32
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 639 ms / 2,000 ms
コード長 603 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 178 ms
コンパイル使用メモリ 85,760 KB
実行使用メモリ 247,504 KB
最終ジャッジ日時 2026-04-27 23:14:54
合計ジャッジ時間 11,770 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools

def main():
  n, m, w = [int(x) for x in input().split()]
  a = [int(x) for x in input().split()]
  b = [int(x) for x in input().split()]
  c = [int(x) for x in input().split()]
  a.sort(reverse=True)
  ac = list(itertools.accumulate(a))
  ac.insert(0, 0)
  bc = [[bc_i, (0, 0)] for bc_i in zip(b, c)]
  ans = 0

  for ch in itertools.product(*bc):
    cap = 0
    val = 0
    for bi, ci in ch:
      cap += bi
      val += ci
      if cap > w:
        break
    if cap <= w:
      val += ac[min(n, w - cap)]
      ans = max(ans, val)

  print(ans)

if __name__ == "__main__":
  main()
0