結果

問題 No.2317 Expression Menu
ユーザー とろちゃとろちゃ
提出日時 2023-05-27 13:00:11
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,417 bytes
コンパイル時間 972 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 299,668 KB
最終ジャッジ日時 2023-08-26 20:32:27
合計ジャッジ時間 47,998 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,260 KB
testcase_01 AC 70 ms
70,948 KB
testcase_02 AC 115 ms
90,988 KB
testcase_03 AC 1,483 ms
299,044 KB
testcase_04 AC 1,194 ms
299,532 KB
testcase_05 AC 1,470 ms
299,200 KB
testcase_06 AC 1,059 ms
299,412 KB
testcase_07 AC 1,292 ms
299,184 KB
testcase_08 AC 1,135 ms
299,540 KB
testcase_09 AC 1,129 ms
299,432 KB
testcase_10 AC 1,256 ms
299,236 KB
testcase_11 AC 1,265 ms
299,472 KB
testcase_12 AC 1,346 ms
299,408 KB
testcase_13 AC 1,262 ms
299,292 KB
testcase_14 AC 1,647 ms
299,248 KB
testcase_15 AC 1,104 ms
299,124 KB
testcase_16 AC 1,356 ms
299,200 KB
testcase_17 AC 1,872 ms
299,216 KB
testcase_18 AC 1,154 ms
299,052 KB
testcase_19 AC 1,485 ms
299,452 KB
testcase_20 AC 1,426 ms
299,132 KB
testcase_21 AC 1,167 ms
299,284 KB
testcase_22 AC 1,068 ms
299,048 KB
testcase_23 TLE -
testcase_24 AC 1,655 ms
299,600 KB
testcase_25 AC 1,504 ms
299,348 KB
testcase_26 AC 1,536 ms
299,592 KB
testcase_27 AC 1,549 ms
299,396 KB
testcase_28 AC 1,835 ms
299,112 KB
testcase_29 AC 1,783 ms
299,276 KB
testcase_30 AC 1,798 ms
299,340 KB
testcase_31 AC 1,621 ms
299,580 KB
testcase_32 AC 1,568 ms
299,464 KB
testcase_33 AC 72 ms
71,352 KB
testcase_34 AC 71 ms
70,924 KB
testcase_35 AC 75 ms
76,040 KB
testcase_36 AC 71 ms
71,304 KB
testcase_37 AC 73 ms
71,216 KB
testcase_38 AC 480 ms
299,032 KB
testcase_39 AC 783 ms
299,292 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] * (Y + 1) for _ in range(X + 1)] for _ in range(N + 1)]
flag = [[0] * (Y + 1) for _ in range(X + 1)]
flag[0][0] = 1

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

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