結果
| 問題 | 
                            No.2317 Expression Menu
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2023-05-26 21:28:48 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,760 ms / 2,000 ms | 
| コード長 | 1,132 bytes | 
| コンパイル時間 | 266 ms | 
| コンパイル使用メモリ | 82,688 KB | 
| 実行使用メモリ | 289,536 KB | 
| 最終ジャッジ日時 | 2024-12-25 04:58:31 | 
| 合計ジャッジ時間 | 47,787 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 37 | 
ソースコード
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()