結果

問題 No.2317 Expression Menu
ユーザー Ekiben542Ekiben542
提出日時 2023-05-26 22:34:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 524 bytes
コンパイル時間 735 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2023-08-26 12:41:23
合計ジャッジ時間 29,304 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,916 KB
testcase_01 AC 14 ms
8,148 KB
testcase_02 AC 74 ms
9,072 KB
testcase_03 AC 932 ms
12,724 KB
testcase_04 AC 843 ms
12,400 KB
testcase_05 AC 1,126 ms
13,604 KB
testcase_06 AC 919 ms
12,864 KB
testcase_07 AC 1,106 ms
12,820 KB
testcase_08 AC 1,003 ms
12,532 KB
testcase_09 AC 1,118 ms
13,136 KB
testcase_10 AC 1,047 ms
12,660 KB
testcase_11 AC 1,275 ms
13,284 KB
testcase_12 AC 1,138 ms
13,188 KB
testcase_13 AC 1,078 ms
13,108 KB
testcase_14 AC 1,554 ms
14,008 KB
testcase_15 AC 1,030 ms
12,624 KB
testcase_16 AC 1,193 ms
13,484 KB
testcase_17 AC 1,345 ms
13,572 KB
testcase_18 AC 1,075 ms
12,896 KB
testcase_19 AC 1,416 ms
13,476 KB
testcase_20 AC 1,330 ms
13,896 KB
testcase_21 AC 878 ms
12,904 KB
testcase_22 AC 899 ms
12,616 KB
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

N, X, Y = map(int, input().split())
dp = [[-1] * (Y + 1) for _ in range(X + 1)]
dp[0][0] = 0
for _ in range(N):
    A, B, C = map(int, input().split())
    for i in range(X - A, -1, -1):
        for j in range(Y - B, -1, -1):
            if dp[i][j] != -1:
                dp[i + A][j + B] = max(dp[i + A][j + B], dp[i][j] + C)

max_heap = []
for i in range(X + 1):
    for j in range(Y + 1):
        if dp[i][j] != -1:
            heapq.heappush(max_heap, -dp[i][j])

ans = -heapq.heappop(max_heap)
print(ans)
0