結果

問題 No.2317 Expression Menu
ユーザー kyskys
提出日時 2023-05-26 21:28:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,470 ms / 2,000 ms
コード長 1,132 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 290,812 KB
最終ジャッジ日時 2023-08-26 10:20:54
合計ジャッジ時間 39,576 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,328 KB
testcase_01 AC 73 ms
71,232 KB
testcase_02 AC 177 ms
92,252 KB
testcase_03 AC 1,235 ms
290,524 KB
testcase_04 AC 1,373 ms
290,488 KB
testcase_05 AC 1,373 ms
290,720 KB
testcase_06 AC 1,243 ms
290,204 KB
testcase_07 AC 1,260 ms
290,464 KB
testcase_08 AC 1,410 ms
290,532 KB
testcase_09 AC 1,227 ms
290,748 KB
testcase_10 AC 1,177 ms
290,544 KB
testcase_11 AC 1,453 ms
290,328 KB
testcase_12 AC 1,460 ms
290,196 KB
testcase_13 AC 1,243 ms
290,660 KB
testcase_14 AC 1,345 ms
290,812 KB
testcase_15 AC 1,212 ms
290,528 KB
testcase_16 AC 1,374 ms
290,488 KB
testcase_17 AC 1,470 ms
290,212 KB
testcase_18 AC 1,180 ms
290,384 KB
testcase_19 AC 1,379 ms
290,564 KB
testcase_20 AC 1,435 ms
290,212 KB
testcase_21 AC 1,375 ms
290,420 KB
testcase_22 AC 1,359 ms
290,400 KB
testcase_23 AC 939 ms
290,648 KB
testcase_24 AC 929 ms
290,604 KB
testcase_25 AC 942 ms
290,312 KB
testcase_26 AC 931 ms
290,308 KB
testcase_27 AC 935 ms
290,212 KB
testcase_28 AC 937 ms
290,600 KB
testcase_29 AC 928 ms
290,472 KB
testcase_30 AC 930 ms
290,208 KB
testcase_31 AC 927 ms
290,640 KB
testcase_32 AC 926 ms
290,196 KB
testcase_33 AC 68 ms
71,272 KB
testcase_34 AC 69 ms
71,176 KB
testcase_35 AC 76 ms
77,868 KB
testcase_36 AC 72 ms
74,948 KB
testcase_37 AC 73 ms
74,904 KB
testcase_38 AC 579 ms
290,344 KB
testcase_39 AC 599 ms
290,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from sys import stdin, setrecursionlimit
    # setrecursionlimit(1000000)
    input = stdin.readline
    def iinput(): return int(input())
    def sinput(): return input().rstrip()
    def i0input(): return int(input()) - 1
    def linput(): return list(input().split())
    def liinput(): return list(map(int, input().split()))
    def miinput(): return map(int, input().split())
    def li0input(): return list(map(lambda x: int(x) - 1, input().split()))
    def mi0input(): return map(lambda x: int(x) - 1, input().split())
    INF = 1000000000000000000
    MOD = 1000000007

    N, X, Y = miinput()
    dp = [0] * ((N + 1) * (X + 1) * (Y + 1))

    def index(i, x, y):
        return i * (X + 1) * (Y + 1) + x * (Y + 1) + y

    for i in range(N):
        a, b, c = miinput()
        for x in range(X+1):
            for y in range(Y+1):
                dp[index(i+1, x, y)] = max(dp[index(i+1, x, y)], dp[index(i, x, y)])
                if x + a <= X and y + b <= Y:
                    dp[index(i+1, x+a, y+b)] = max(dp[index(i+1, x+a, y+b)], dp[index(i, x, y)] + c)
    
    print(dp[index(N, X, Y)])

main()
0