結果

問題 No.2317 Expression Menu
ユーザー miya145592miya145592
提出日時 2023-05-26 22:00:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 938 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 298,876 KB
最終ジャッジ日時 2023-08-26 11:32:54
合計ジャッジ時間 28,930 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,176 KB
testcase_01 AC 65 ms
71,220 KB
testcase_02 AC 103 ms
87,180 KB
testcase_03 AC 778 ms
298,752 KB
testcase_04 AC 793 ms
298,672 KB
testcase_05 AC 893 ms
298,560 KB
testcase_06 AC 752 ms
298,668 KB
testcase_07 AC 817 ms
298,356 KB
testcase_08 AC 771 ms
298,584 KB
testcase_09 AC 782 ms
298,704 KB
testcase_10 AC 830 ms
298,848 KB
testcase_11 AC 829 ms
298,792 KB
testcase_12 AC 846 ms
298,392 KB
testcase_13 AC 845 ms
298,548 KB
testcase_14 AC 884 ms
298,360 KB
testcase_15 AC 810 ms
298,876 KB
testcase_16 AC 836 ms
298,352 KB
testcase_17 AC 878 ms
298,308 KB
testcase_18 AC 797 ms
298,712 KB
testcase_19 AC 877 ms
298,544 KB
testcase_20 AC 867 ms
298,716 KB
testcase_21 AC 771 ms
298,608 KB
testcase_22 AC 769 ms
298,636 KB
testcase_23 AC 914 ms
298,624 KB
testcase_24 AC 878 ms
298,680 KB
testcase_25 AC 859 ms
298,728 KB
testcase_26 AC 865 ms
298,744 KB
testcase_27 AC 903 ms
298,776 KB
testcase_28 AC 878 ms
298,648 KB
testcase_29 AC 912 ms
298,656 KB
testcase_30 AC 884 ms
298,716 KB
testcase_31 AC 938 ms
298,592 KB
testcase_32 AC 864 ms
298,744 KB
testcase_33 AC 64 ms
71,476 KB
testcase_34 AC 66 ms
71,176 KB
testcase_35 AC 75 ms
76,512 KB
testcase_36 AC 69 ms
75,136 KB
testcase_37 AC 71 ms
75,032 KB
testcase_38 AC 582 ms
298,300 KB
testcase_39 AC 573 ms
298,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y = map(int, input().split())
ABC = [list(map(int,  input().split())) for _ in range(N)]
dp = [[[-1 for _ in range(Y+1)] for _ in range(X+1)] for _ in range(N+1)]
dp[0][0][0] = 0
for i in range(N):
    for x in range(X+1):
        for y in range(Y+1):
            if dp[i][x][y]<0:
                continue
            dp[i+1][x][y] = max(dp[i+1][x][y], dp[i][x][y])
            a, b, c = ABC[i]
            if x+a<=X and y+b<=Y:
                dp[i+1][x+a][y+b] = max(dp[i+1][x+a][y+b], dp[i][x][y]+c)
ans = -1
for x in range(X+1):
    for y in range(Y+1):
        ans = max(ans, dp[N][x][y])
print(ans)
0