結果

問題 No.2317 Expression Menu
ユーザー prin_kemkemprin_kemkem
提出日時 2023-05-27 00:47:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,726 ms / 2,000 ms
コード長 944 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 229,764 KB
最終ジャッジ日時 2024-12-25 12:15:13
合計ジャッジ時間 49,878 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
import copy
from itertools import combinations, permutations, product, accumulate, groupby
from heapq import heapify, heappop, heappush
import math
import bisect
from pprint import pprint
from random import randint
import sys
# sys.setrecursionlimit(700000)
input = lambda: sys.stdin.readline().rstrip('\n')
inf = float('inf')
mod1 = 10**9+7
mod2 = 998244353
def ceil_div(x, y): return -(-x//y)

#################################################

N, X, Y = map(int, input().split())
dp = [[-inf]*(Y+1) for _ in range(X+1)]
dp[0][0] = 0
for _ in range(N):
    a, b, c = map(int, input().split())
    ndp = [[dp[i][j] for j in range(Y+1)] for i in range(X+1)]
    for i in range(X):
        for j in range(Y):
            if i+a <= X and j+b <= Y:
                ndp[i+a][j+b] = max(ndp[i+a][j+b], dp[i][j]+c)
    dp = ndp
ans = 0
for i in range(X+1):
    ans = max(ans, max(dp[i]))
print(ans)
0