結果

問題 No.2317 Expression Menu
ユーザー Ekiben542Ekiben542
提出日時 2023-05-26 22:54:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 539 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 10,936 KB
実行使用メモリ 11,608 KB
最終ジャッジ日時 2023-08-26 13:14:52
合計ジャッジ時間 41,055 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,976 KB
testcase_01 AC 17 ms
8,112 KB
testcase_02 AC 97 ms
8,676 KB
testcase_03 AC 1,494 ms
10,816 KB
testcase_04 AC 1,386 ms
10,648 KB
testcase_05 AC 1,818 ms
11,556 KB
testcase_06 AC 1,470 ms
11,024 KB
testcase_07 AC 1,629 ms
10,876 KB
testcase_08 AC 1,517 ms
10,860 KB
testcase_09 AC 1,981 ms
11,012 KB
testcase_10 AC 1,840 ms
10,840 KB
testcase_11 AC 1,983 ms
11,292 KB
testcase_12 AC 1,862 ms
11,116 KB
testcase_13 AC 1,860 ms
11,092 KB
testcase_14 TLE -
testcase_15 AC 1,708 ms
10,864 KB
testcase_16 TLE -
testcase_17 AC 1,959 ms
11,608 KB
testcase_18 AC 1,783 ms
10,956 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 AC 1,512 ms
10,940 KB
testcase_22 AC 1,527 ms
10,740 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_val = 0  

for _ in range(N):
    A, B, C = map(int, input().split())
    
    # XからAまでの範囲を逆順で探索する
    for i in range(X, A - 1, -1):
        # YからBまでの範囲を逆順で探索する
        for j in range(Y, B - 1, -1):
            if dp[i - A][j - B] != -1:
                dp[i][j] = max(dp[i][j], dp[i - A][j - B] + C)
                max_val = max(max_val, dp[i][j])

print(max_val)
0