結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,012 KB
testcase_01 AC 15 ms
7,992 KB
testcase_02 AC 65 ms
8,900 KB
testcase_03 AC 1,388 ms
59,412 KB
testcase_04 AC 1,170 ms
49,168 KB
testcase_05 AC 1,766 ms
94,680 KB
testcase_06 AC 1,222 ms
53,012 KB
testcase_07 AC 1,489 ms
73,660 KB
testcase_08 AC 1,309 ms
57,704 KB
testcase_09 AC 1,710 ms
82,396 KB
testcase_10 AC 1,507 ms
71,728 KB
testcase_11 AC 1,983 ms
93,944 KB
testcase_12 AC 1,807 ms
89,812 KB
testcase_13 AC 1,634 ms
83,472 KB
testcase_14 TLE -
testcase_15 AC 1,391 ms
65,196 KB
testcase_16 AC 1,903 ms
98,588 KB
testcase_17 AC 1,869 ms
102,216 KB
testcase_18 AC 1,401 ms
66,956 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 AC 1,321 ms
59,540 KB
testcase_22 AC 1,267 ms
57,216 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
max_heap = [(-dp[0][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)
                heapq.heappush(max_heap, (-dp[i + A][j + B], i + A, j + B))

ans = -max_heap[0][0]
print(ans)
0