結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,156 KB
testcase_01 AC 17 ms
7,832 KB
testcase_02 AC 23 ms
7,816 KB
testcase_03 AC 28 ms
7,752 KB
testcase_04 AC 26 ms
7,820 KB
testcase_05 AC 250 ms
7,808 KB
testcase_06 AC 16 ms
7,868 KB
testcase_07 AC 16 ms
7,828 KB
testcase_08 AC 16 ms
7,936 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())

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

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