結果

問題 No.2390 Udon Coupon (Hard)
ユーザー cleanttedcleantted
提出日時 2023-07-15 17:54:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,533 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 91,628 KB
最終ジャッジ日時 2023-10-17 04:14:58
合計ジャッジ時間 15,026 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
90,824 KB
testcase_01 AC 164 ms
91,152 KB
testcase_02 AC 164 ms
91,480 KB
testcase_03 AC 170 ms
91,536 KB
testcase_04 AC 168 ms
91,536 KB
testcase_05 WA -
testcase_06 AC 159 ms
90,956 KB
testcase_07 AC 161 ms
90,956 KB
testcase_08 AC 162 ms
90,952 KB
testcase_09 AC 424 ms
91,628 KB
testcase_10 AC 162 ms
91,272 KB
testcase_11 AC 161 ms
90,952 KB
testcase_12 AC 163 ms
91,276 KB
testcase_13 AC 162 ms
91,276 KB
testcase_14 AC 161 ms
91,272 KB
testcase_15 AC 158 ms
90,952 KB
testcase_16 AC 160 ms
91,276 KB
testcase_17 AC 159 ms
91,268 KB
testcase_18 AC 161 ms
91,276 KB
testcase_19 AC 161 ms
91,536 KB
testcase_20 AC 159 ms
90,952 KB
testcase_21 WA -
testcase_22 AC 162 ms
91,536 KB
testcase_23 AC 164 ms
91,536 KB
testcase_24 AC 207 ms
91,552 KB
testcase_25 AC 216 ms
91,548 KB
testcase_26 AC 209 ms
91,548 KB
testcase_27 AC 209 ms
91,548 KB
testcase_28 AC 202 ms
91,536 KB
testcase_29 AC 275 ms
91,552 KB
testcase_30 AC 262 ms
91,520 KB
testcase_31 AC 275 ms
91,552 KB
testcase_32 AC 276 ms
91,544 KB
testcase_33 AC 271 ms
91,540 KB
testcase_34 AC 371 ms
91,548 KB
testcase_35 AC 360 ms
91,544 KB
testcase_36 AC 353 ms
91,544 KB
testcase_37 AC 365 ms
91,548 KB
testcase_38 AC 358 ms
91,524 KB
testcase_39 AC 245 ms
91,628 KB
testcase_40 AC 206 ms
91,552 KB
testcase_41 AC 246 ms
91,624 KB
testcase_42 AC 203 ms
91,540 KB
testcase_43 AC 207 ms
91,536 KB
testcase_44 AC 184 ms
91,536 KB
testcase_45 AC 193 ms
91,544 KB
testcase_46 AC 168 ms
91,536 KB
testcase_47 AC 177 ms
91,536 KB
testcase_48 AC 197 ms
91,552 KB
testcase_49 AC 159 ms
90,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
from math import gcd, log10, pi, sqrt, ceil
from bisect import bisect, bisect_left, bisect_right, insort
from typing import Iterable, TypeVar, Union, Tuple, Iterator, List
# import bisect
import copy
import heapq
import itertools
import math
import random
from fractions import Fraction
from functools import lru_cache, partial, cmp_to_key
import operator
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
# import string
# import networkx as nx
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
# mod = 10 ** 9 + 7
mod = 998244353
# mod = 1 << 128
# mod = 10 ** 30 + 1
INF = 1 << 61
DIFF = 10 ** -9
DX = [1, 0, -1, 0, 1, 1, -1, -1]
DY = [0, 1, 0, -1, 1, -1, 1, -1]

def read_values(): return tuple(map(int, input().split()))
def read_index(): return tuple(map(lambda x: int(x) - 1, input().split()))
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for _ in range(N)]


def main():
    N = int(input())
    S = read_lists(3)
    S += S

    res = 0
    for k in range(3):
        A1, B1 = S[k]
        A2, B2 = S[k + 1]
        A3, B3 = S[k + 2]

        for i in range(A1):
            N1 = N - A1 * i
            if N1 < 0:
                break
            r1 = i * B1

            for j in range(A2):
                N2 = N1 - A2 * j
                if N2 < 0:
                    break
                
                res = max(res, r1 + j * B2 + (N2 // A3) * B3)
    print(res)


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