結果

問題 No.2317 Expression Menu
ユーザー Ekiben542Ekiben542
提出日時 2023-05-26 23:37:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 371 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 80,944 KB
最終ジャッジ日時 2023-08-26 13:59:19
合計ジャッジ時間 9,570 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,664 KB
testcase_01 AC 67 ms
71,428 KB
testcase_02 AC 79 ms
76,544 KB
testcase_03 AC 152 ms
80,128 KB
testcase_04 AC 146 ms
79,912 KB
testcase_05 AC 159 ms
80,408 KB
testcase_06 AC 149 ms
80,004 KB
testcase_07 AC 154 ms
80,184 KB
testcase_08 AC 154 ms
80,572 KB
testcase_09 AC 160 ms
80,452 KB
testcase_10 AC 154 ms
80,120 KB
testcase_11 AC 163 ms
80,824 KB
testcase_12 AC 167 ms
80,944 KB
testcase_13 AC 157 ms
80,000 KB
testcase_14 AC 176 ms
80,828 KB
testcase_15 AC 155 ms
79,840 KB
testcase_16 AC 162 ms
80,608 KB
testcase_17 AC 169 ms
80,440 KB
testcase_18 AC 191 ms
80,864 KB
testcase_19 AC 167 ms
80,824 KB
testcase_20 AC 171 ms
80,504 KB
testcase_21 AC 149 ms
79,840 KB
testcase_22 AC 152 ms
80,368 KB
testcase_23 AC 371 ms
80,168 KB
testcase_24 AC 356 ms
80,360 KB
testcase_25 AC 348 ms
79,992 KB
testcase_26 AC 349 ms
80,264 KB
testcase_27 AC 342 ms
80,064 KB
testcase_28 AC 356 ms
80,208 KB
testcase_29 AC 364 ms
80,212 KB
testcase_30 AC 364 ms
80,332 KB
testcase_31 AC 350 ms
80,264 KB
testcase_32 AC 344 ms
80,044 KB
testcase_33 AC 70 ms
71,380 KB
testcase_34 AC 70 ms
71,536 KB
testcase_35 AC 75 ms
76,368 KB
testcase_36 AC 70 ms
71,588 KB
testcase_37 AC 71 ms
71,336 KB
testcase_38 AC 215 ms
78,408 KB
testcase_39 AC 216 ms
78,220 KB
権限があれば一括ダウンロードができます

ソースコード

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