結果

問題 No.2317 Expression Menu
ユーザー とろちゃとろちゃ
提出日時 2023-05-26 22:27:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,536 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 91,432 KB
最終ジャッジ日時 2023-08-26 12:29:34
合計ジャッジ時間 6,788 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
76,076 KB
testcase_01 AC 75 ms
75,856 KB
testcase_02 AC 90 ms
76,248 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 124 ms
91,176 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 124 ms
91,064 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 125 ms
91,056 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 78 ms
75,148 KB
testcase_34 AC 70 ms
75,240 KB
testcase_35 AC 71 ms
75,132 KB
testcase_36 AC 72 ms
75,168 KB
testcase_37 AC 72 ms
75,204 KB
testcase_38 AC 116 ms
90,552 KB
testcase_39 AC 119 ms
90,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")
# from bisect import *
# from collections import *
# from heapq import *
# from itertools import *
# from math import *
# from datetime import *
# from decimal import*
# from string import ascii_lowercase,ascii_uppercase
# import numpy as np
import sys
import os

# sys.setrecursionlimit(10**6)
INF = 10**18
MOD = 998244353
# MOD = 10**9 + 7
File = open("input.txt", "r") if os.path.exists("input.txt") else sys.stdin


def input():
    return File.readline()[:-1]


# ///////////////////////////////////////////////////////////////////////////


N, X, Y = map(int, input().split())
menu = [list(map(int, input().split())) for _ in range(N)] + [[0, 0, 0]]
dp = [[[0, 0] for _ in range(700)] for _ in range(N + 1)]
flag = [0] * 700
flag[0] = 1

for i in range(N + 1):
    for j in range(500):
        if flag[j]:
            if j + menu[i][0] <= X and dp[i - 1][j][0] + menu[i][1] <= Y:
                dp[i][j + menu[i][0]] = (
                    dp[i][j + menu[i][0]]
                    if dp[i][j + menu[i][0]][1] > dp[i - 1][j][1] + menu[i][2]
                    else [
                        dp[i - 1][j][0] + menu[i][1],
                        dp[i - 1][j][1] + menu[i][2],
                    ]
                )
                flag[j + menu[i][0]] = 1
            dp[i][j] = dp[i][j] if dp[i][j][1] > dp[i - 1][j][1] else dp[i - 1][j]

ans = 0
for i, j in enumerate(dp[-1]):
    if i <= X and j[0] <= Y:
        if ans < j[1]:
            ans = j[1]
print(ans)
0