結果

問題 No.2317 Expression Menu
ユーザー prin_kemkemprin_kemkem
提出日時 2023-05-27 00:53:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,777 ms / 2,000 ms
コード長 938 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 86,472 KB
実行使用メモリ 262,376 KB
最終ジャッジ日時 2023-08-26 14:42:34
合計ジャッジ時間 44,679 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 161 ms
80,716 KB
testcase_01 AC 166 ms
80,808 KB
testcase_02 AC 230 ms
112,092 KB
testcase_03 AC 1,566 ms
261,416 KB
testcase_04 AC 1,520 ms
261,392 KB
testcase_05 AC 1,777 ms
261,620 KB
testcase_06 AC 1,509 ms
261,368 KB
testcase_07 AC 1,514 ms
261,144 KB
testcase_08 AC 1,513 ms
261,736 KB
testcase_09 AC 1,518 ms
261,332 KB
testcase_10 AC 1,547 ms
261,560 KB
testcase_11 AC 1,501 ms
261,524 KB
testcase_12 AC 1,537 ms
261,172 KB
testcase_13 AC 1,492 ms
261,996 KB
testcase_14 AC 1,551 ms
261,644 KB
testcase_15 AC 1,458 ms
262,376 KB
testcase_16 AC 1,551 ms
261,792 KB
testcase_17 AC 1,596 ms
262,008 KB
testcase_18 AC 1,520 ms
261,388 KB
testcase_19 AC 1,604 ms
261,132 KB
testcase_20 AC 1,563 ms
261,712 KB
testcase_21 AC 1,491 ms
261,292 KB
testcase_22 AC 1,463 ms
261,444 KB
testcase_23 AC 769 ms
260,852 KB
testcase_24 AC 793 ms
260,572 KB
testcase_25 AC 758 ms
260,792 KB
testcase_26 AC 752 ms
261,044 KB
testcase_27 AC 794 ms
261,040 KB
testcase_28 AC 786 ms
260,808 KB
testcase_29 AC 778 ms
260,672 KB
testcase_30 AC 770 ms
260,716 KB
testcase_31 AC 806 ms
261,180 KB
testcase_32 AC 797 ms
260,928 KB
testcase_33 AC 159 ms
80,764 KB
testcase_34 AC 159 ms
80,640 KB
testcase_35 AC 166 ms
84,964 KB
testcase_36 AC 156 ms
80,684 KB
testcase_37 AC 153 ms
80,812 KB
testcase_38 AC 1,605 ms
261,052 KB
testcase_39 AC 689 ms
260,712 KB
権限があれば一括ダウンロードができます

ソースコード

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 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))
0