結果

問題 No.2390 Udon Coupon (Hard)
ユーザー ShirotsumeShirotsume
提出日時 2023-07-21 22:00:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,132 ms / 2,000 ms
コード長 677 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 72,064 KB
最終ジャッジ日時 2024-04-15 21:01:51
合計ジャッジ時間 43,926 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 480 ms
68,864 KB
testcase_01 AC 804 ms
70,784 KB
testcase_02 AC 1,094 ms
69,248 KB
testcase_03 AC 1,089 ms
68,096 KB
testcase_04 AC 1,082 ms
69,120 KB
testcase_05 AC 372 ms
69,504 KB
testcase_06 AC 1,066 ms
70,016 KB
testcase_07 AC 230 ms
65,408 KB
testcase_08 AC 229 ms
65,664 KB
testcase_09 AC 1,095 ms
70,656 KB
testcase_10 AC 524 ms
72,064 KB
testcase_11 AC 321 ms
70,400 KB
testcase_12 AC 469 ms
70,656 KB
testcase_13 AC 387 ms
70,784 KB
testcase_14 AC 537 ms
70,784 KB
testcase_15 AC 484 ms
70,016 KB
testcase_16 AC 816 ms
70,528 KB
testcase_17 AC 263 ms
69,888 KB
testcase_18 AC 319 ms
71,424 KB
testcase_19 AC 337 ms
71,424 KB
testcase_20 AC 233 ms
65,408 KB
testcase_21 AC 233 ms
66,560 KB
testcase_22 AC 1,094 ms
68,352 KB
testcase_23 AC 1,084 ms
68,480 KB
testcase_24 AC 1,102 ms
69,248 KB
testcase_25 AC 1,101 ms
70,144 KB
testcase_26 AC 1,123 ms
69,632 KB
testcase_27 AC 1,107 ms
70,144 KB
testcase_28 AC 1,084 ms
69,632 KB
testcase_29 AC 1,079 ms
68,992 KB
testcase_30 AC 1,089 ms
68,352 KB
testcase_31 AC 1,083 ms
69,888 KB
testcase_32 AC 1,091 ms
69,760 KB
testcase_33 AC 1,097 ms
68,864 KB
testcase_34 AC 1,093 ms
68,992 KB
testcase_35 AC 1,101 ms
70,016 KB
testcase_36 AC 1,093 ms
69,120 KB
testcase_37 AC 1,090 ms
69,760 KB
testcase_38 AC 1,059 ms
68,480 KB
testcase_39 AC 909 ms
71,424 KB
testcase_40 AC 1,079 ms
69,888 KB
testcase_41 AC 1,106 ms
68,608 KB
testcase_42 AC 1,102 ms
68,480 KB
testcase_43 AC 1,091 ms
68,480 KB
testcase_44 AC 1,064 ms
69,888 KB
testcase_45 AC 1,064 ms
69,760 KB
testcase_46 AC 1,082 ms
68,864 KB
testcase_47 AC 1,098 ms
68,736 KB
testcase_48 AC 1,132 ms
68,992 KB
testcase_49 AC 226 ms
65,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
from math import gcd
n = ii()

AB = [tuple(li()) for _ in range(3)]
import itertools

ans = 0 
for v in itertools.permutations(range(3)):
    a1, b1 = AB[v[0]]
    a2, b2 = AB[v[1]]
    a3, b3 = AB[v[2]]
    for i in range(3000):
        for j in range(3000):
            if a1 * i + a2 * j > n:
                continue
            k = (n - a1 * i - a2 * j) // a3
            ans = max(ans, b1 * i + b2 * j + b3 * k)
print(ans)


0