結果

問題 No.2317 Expression Menu
ユーザー Ekiben542Ekiben542
提出日時 2023-05-26 22:37:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 581 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 15,732 KB
最終ジャッジ日時 2023-08-26 12:46:41
合計ジャッジ時間 25,852 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,552 KB
testcase_01 AC 17 ms
8,172 KB
testcase_02 AC 75 ms
8,912 KB
testcase_03 AC 1,605 ms
14,244 KB
testcase_04 AC 1,388 ms
12,596 KB
testcase_05 TLE -
testcase_06 AC 1,537 ms
14,568 KB
testcase_07 AC 1,876 ms
14,260 KB
testcase_08 AC 1,595 ms
13,872 KB
testcase_09 TLE -
testcase_10 AC 1,917 ms
13,772 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
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())
    heap = []
    for i in range(X - A + 1):
        for j in range(Y - B + 1):
            if dp[i][j] != -1:
                heapq.heappush(heap, (-dp[i][j], i, j))
    while heap:
        val, i, j = heapq.heappop(heap)
        dp[i + A][j + B] = max(dp[i + A][j + B], -val + C)

ans = 0
for i in range(X + 1):
    for j in range(Y + 1):
        if dp[i][j] != -1:
            ans = max(ans, dp[i][j])
print(ans)
0