結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
17,968 KB
testcase_01 AC 15 ms
7,956 KB
testcase_02 AC 90 ms
8,792 KB
testcase_03 AC 1,317 ms
11,028 KB
testcase_04 AC 1,238 ms
10,632 KB
testcase_05 AC 1,698 ms
11,412 KB
testcase_06 AC 1,320 ms
11,076 KB
testcase_07 AC 1,622 ms
10,852 KB
testcase_08 AC 1,359 ms
10,888 KB
testcase_09 AC 1,691 ms
11,004 KB
testcase_10 AC 1,658 ms
10,828 KB
testcase_11 AC 1,812 ms
11,176 KB
testcase_12 AC 1,697 ms
11,100 KB
testcase_13 AC 1,525 ms
11,168 KB
testcase_14 TLE -
testcase_15 AC 1,393 ms
10,836 KB
testcase_16 AC 1,881 ms
11,404 KB
testcase_17 AC 1,655 ms
11,532 KB
testcase_18 AC 1,551 ms
10,956 KB
testcase_19 TLE -
testcase_20 TLE -
testcase_21 AC 1,339 ms
11,044 KB
testcase_22 AC 1,381 ms
10,816 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