結果

問題 No.2390 Udon Coupon (Hard)
コンテスト
ユーザー cleantted
提出日時 2023-07-03 13:44:23
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 632 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 629 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 35,936 KB
最終ジャッジ日時 2026-04-02 13:44:16
合計ジャッジ時間 13,452 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2 TLE * 1
other RE * 29 TLE * 3 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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(
  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(t1, t2, t3)
  print(result)

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