結果
| 問題 |
No.2317 Expression Menu
|
| コンテスト | |
| ユーザー |
prin_kemkem
|
| 提出日時 | 2023-05-27 00:53:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,886 ms / 2,000 ms |
| コード長 | 938 bytes |
| コンパイル時間 | 1,157 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 262,880 KB |
| 最終ジャッジ日時 | 2024-12-25 12:23:54 |
| 合計ジャッジ時間 | 48,145 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
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 for _ in range((X+1)*(Y+1))]
dp[0] = 0
for _ in range(N):
a, b, c = map(int, input().split())
ndp = [-inf]*(X+1)*(Y+1)
for i in range(X+1):
for j in range(Y+1):
ndp[i*(Y+1)+j] = max(ndp[i*(Y+1)+j], dp[i*(Y+1)+j])
if i+a <= X and j+b <= Y:
ndp[(i+a)*(Y+1)+j+b] = max(ndp[(i+a)*(Y+1)+j+b], dp[i*(Y+1)+j]+c)
dp = ndp
print(max(dp))
prin_kemkem