結果

問題 No.2093 Shio Ramen
ユーザー first_vilfirst_vil
提出日時 2022-10-08 15:05:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 824 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 76,976 KB
最終ジャッジ日時 2023-09-04 20:42:42
合計ジャッジ時間 5,023 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,232 KB
testcase_01 AC 73 ms
71,316 KB
testcase_02 AC 72 ms
71,364 KB
testcase_03 AC 72 ms
71,052 KB
testcase_04 AC 73 ms
71,340 KB
testcase_05 AC 72 ms
71,380 KB
testcase_06 AC 71 ms
71,312 KB
testcase_07 AC 74 ms
71,320 KB
testcase_08 AC 73 ms
71,184 KB
testcase_09 AC 93 ms
76,612 KB
testcase_10 AC 102 ms
76,768 KB
testcase_11 AC 89 ms
76,412 KB
testcase_12 AC 92 ms
76,796 KB
testcase_13 AC 88 ms
76,528 KB
testcase_14 AC 90 ms
76,620 KB
testcase_15 AC 106 ms
76,976 KB
testcase_16 AC 95 ms
76,700 KB
testcase_17 AC 96 ms
76,772 KB
testcase_18 AC 110 ms
76,652 KB
testcase_19 AC 103 ms
76,824 KB
testcase_20 AC 100 ms
76,452 KB
testcase_21 AC 100 ms
76,848 KB
testcase_22 AC 103 ms
76,844 KB
testcase_23 AC 109 ms
76,728 KB
testcase_24 AC 107 ms
76,788 KB
testcase_25 AC 106 ms
76,792 KB
testcase_26 AC 110 ms
76,836 KB
testcase_27 AC 106 ms
76,688 KB
testcase_28 AC 111 ms
76,968 KB
testcase_29 AC 106 ms
76,624 KB
testcase_30 AC 109 ms
76,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
# mod = int(1e9 + 7)
mod = 998244353


def chmax(a, v, *args):
    b = a
    for i in args[:-1]:
        b = b[i]
    if b[args[-1]] < v:
        b[args[-1]] = v


N, I = mi()
s = [0] * N
a = [0] * N
for i in range(N):
    s[i], a[i] = mi()

dp = [-INF] * (I + 1)
dp[0] = 0
for i in range(N):
    for j in range(0, I + 1)[::-1]:
        if j + s[i] <= I:
            chmax(dp, dp[j] + a[i], j + s[i])
print(max(dp))
0