結果

問題 No.2317 Expression Menu
ユーザー とろちゃとろちゃ
提出日時 2023-05-26 22:11:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,652 bytes
コンパイル時間 1,841 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 98,872 KB
最終ジャッジ日時 2023-08-26 11:53:00
合計ジャッジ時間 8,164 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 76 ms
75,312 KB
testcase_02 AC 84 ms
76,124 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 171 ms
97,924 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 169 ms
97,828 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 172 ms
97,824 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 172 ms
97,872 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 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 75 ms
75,256 KB
testcase_37 AC 76 ms
75,484 KB
testcase_38 WA -
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

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)]
dp = [[[0, 0, 0] for _ in range(700)] for _ in range(N + 1)]

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

ans = 0
for i in range(X):
    ans = max(ans, dp[N - 1][i][2])
print(ans)
0