結果

問題 No.2390 Udon Coupon (Hard)
ユーザー cleanttedcleantted
提出日時 2023-07-03 12:49:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 602 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 12,552 KB
最終ジャッジ日時 2023-09-26 08:04:21
合計ジャッジ時間 4,380 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,808 KB
testcase_01 AC 17 ms
7,928 KB
testcase_02 AC 23 ms
7,756 KB
testcase_03 AC 28 ms
7,744 KB
testcase_04 AC 26 ms
7,936 KB
testcase_05 AC 247 ms
7,772 KB
testcase_06 AC 16 ms
7,700 KB
testcase_07 AC 16 ms
7,924 KB
testcase_08 AC 16 ms
7,852 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def co_solve(n, a0, b0, a1, b1, a2, b2):
  r = 0
  for i in range(min(a0, n // a1 + 1)):
    d = n - i * a1
    for j in range(a0):
      r = max(r, (d // a0) * b0 + i * b1 + j * b2)
      d -= a2
      if d < 0:
        break
  return r

def main():
  n = int(input())
  a0, b0 = (int(x) for x in input().split())
  a1, b1 = (int(x) for x in input().split())
  a2, b2 = (int(x) for x in input().split())

  result = max(
    co_solve(n, a0, b0, a1, b1, a2, b2),
    co_solve(n, a1, b1, a2, b2, a0, b0),
    co_solve(n, a2, b2, a0, b0, a1, b1),
  )
  print(result)

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