結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
75,128 KB
testcase_01 AC 71 ms
75,124 KB
testcase_02 AC 82 ms
76,096 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 151 ms
97,884 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 152 ms
97,772 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 147 ms
97,768 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 153 ms
97,640 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 67 ms
71,072 KB
testcase_34 AC 70 ms
71,220 KB
testcase_35 AC 67 ms
71,364 KB
testcase_36 AC 66 ms
71,376 KB
testcase_37 AC 67 ms
71,308 KB
testcase_38 AC 113 ms
91,268 KB
testcase_39 AC 120 ms
91,284 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)]
dp = [[[0, 0, 0] for _ in range(700)] for _ in range(N)]

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(301):
    ans = max(ans, dp[N - 1][i][2])
print(ans)
0